In the preceding example, we saw a Jasmine test suite for JavaScript testing, but what about for Angular, how should that look? Actually, there is no direct answer as, for the Angular project test suite, we will not use a browser-based test suite; we have a test runner with Karma for the test suite. But as we are familiar with the browser-based Jasmine test suite in the preceding example, let's see what that will look like if we make a similar one for the Angular project.
We will have to add a subfolder as src
in the Angular project for the test spec, and then the project's folder structure will look like this:
Note
In the Angular project, we will use TypeScript rather than plain JavaScript as Angular officially suggests using TypeScript. So, we hope that we all know the TypeScript syntax and know how to compile to JS.
In this book, for the Angular test suite, we will use SystemJS as the module loader, as Angular officially suggests it; we will take a look...