Introducing unit tests in Angular
In the previous section, we familiarized ourselves with unit testing and its general concepts, such as test suites, test specs, and assertions. It is now time to venture into unit testing with Angular, armed with that knowledge. Before we start writing tests for Angular, though, let's have a look at the tooling that the Angular framework and the Angular CLI provide us to make unit testing a pleasant experience:
- Jasmine: We have already learned that this is the testing framework.
- Karma: The test runner for running our unit tests.
- Angular testing utilities: A set of helper methods that assist us in setting up our unit tests and writing our assertions in the context of the Angular framework.
Configuring Karma as the test runner
In terms of configuration, when using the Angular CLI, we don't have to do anything to make it work. As soon as we create a new Angular CLI project, unit testing works out of the box. As we venture...