Unit tests form the base of the testing pyramid. They test individual components or functionalities to validate that it works as expected in isolated conditions. It is important to run a number of scenarios in unit tests – happy path, error handling, etc.
Unit testing pros and cons
Allow safer refactoring
A better understanding of the code
Force better code
Add new features without breaking anythink
Harder to add some changes
Time
Cannot catch all errors in a program
Angular testing tools
Jasmine is a behavior-driven development framework
Karma is a task runner for our tests in the browser.
TestBed is the primary API for unit tests for Angular application
Spectator is a wrapper under TestBed to simplify Angular unit tests.