Unit testing components with Observables
If you're building an Angular application, it is very likely that you'll work with Observables inside the app at some point. For instance, you could be fetching data from a third-party API or perhaps just managing the state. In either case, it becomes slightly difficult to test applications that have Observables in action. In this recipe, we're going to learn how to test unit tests with Observables.
Getting ready
The project for this recipe resides in chapter10/start_here/unit-testing-observables
. Perform the following steps:
- Open the project in Visual Studio Code.
- Open the Terminal and run
npm install
to install the dependencies of the project. - Once done, run
ng serve -o
.
This should open the app in a new browser tab. You should see something similar to the following screenshot:
Now...