Now that we have the required setup, we are going to start writing the unit tests. Unit tests are written in a file next to the source file with .spec added to the filename. For example, if we are writing test cases for app.component.ts, we would create a file named app.component.spec.ts in the same folder and write the required test cases.
Refer to https://angular.io/docs/ts/latest/guide/testing.html#!#q-spec-file-location and https://angular.io/docs/ts/latest/guide/style-guide.html#!#02-10 for more information.
First, we would start off by writing tests for the app component. We are going to test the following cases:
- If the component has been created.
- If rootPage is set as LoginPage.
Now, create a file named app.component.spec.ts ...