About the Author

Todd Leininger

Todd Leininger is a Software Developer from the the Kansas City area. In his spare time he loves to play guitar and play video games. He is the proud to be raising two great children with his wife Michelle.

Complex Reactive Forms in Angular

Create Complex Reactive Forms in Angular

Todd Leininger Angular, Development Technologies, JavaScript, Tutorial Leave a Comment

Recently on a client project, I was tasked with creating an Angular application that contained a form that displayed conditional inputs. In this article, I will walk through the strategy I implemented to accomplish this goal.

My hope is that this blog will give you a starting point for creating your own complex Angular Reactive forms. Let’s get started!

JASMINE SPIES UNIT TESTING

Unit Testing Using Jasmine Spies

Todd Leininger Development Technologies, Programming, Testing, Tutorial Leave a Comment

Unit testing is an important part of the development process. It gives us the ability to know that our code is working as intended and can also let us know if we may have broken something that we didn’t even think of.

With the help of Jasmine Spies, we can make our test setup easier, and we can give ourselves more options for what we can test against. Hopefully, this will give you a good starting point for all your Jasmine spying needs!

JSON Server for API Mocking

JSON Server to Mock API Servers: A Quick and Easy Solution

Todd Leininger Cloud, Development Technologies, JavaScript, Testing, Tutorial Leave a Comment

I have found myself in the following scenario many times throughout my career. Everyone is ready to get the project started. You know what you are going to be working on, and as the frontend developer, you get started right away. You get to the point that you are ready to test your code to see how the API calls work. There’s one major thing in your way, though. The APIs aren’t done yet.

You could just create some static JSON files and read them in, but that doesn’t really test out calling an API. That’s where JSON Server swoops in to save the day. In this post, I’ll walk through how to use JSON Server. We’ll set up our environment, serve a simple JSON file, and generate mock data.

Getting Started with Marble Testing

Todd Leininger Testing, Tutorial Leave a Comment

When working with RxJS observables, it can get a little tricky to unit test. Sometimes it can be hard to get insight into what is going on with the observable in the test. I’ve personally been frustrated numerous times by trying to test my observables with the subscribe and assert method. This is where marble testing can make testing observables easier.

The main advantage of using marble testing is the marble diagrams. With the diagrams, we have a visual representation of our observables and subscriptions so we can see the interactions between the two. Once the basics are understood, you should be able to get observable tests running in no time.

In this post, I will show you how to get started using Marble testing with an example. By the end, you should have enough information to get started on your journey testing observables. My examples are based on an Angular application using Jasmine, but these can also be applied to different testing frameworks for React and other applications.