Summary

In this last chapter of the book, we learned how to write concise unit tests for our components. We followed a BDD style approach of writing tests, and we also covered the basics of the JavaScript testing framework, Jasmine.

We learned about the debugging tools that are available in Angular, and how to set up an environment for testing. Using the Angular Testbed utility class, we were able to perform tests in a very flexible but precise way. We also learned about the debug view tree and the component fixture. These allowed us to perform clever inspections and apply practical queries to the rendered views, in order to assert expected results.

We used the inject and async helpers to inject dependencies, and to run asynchronous tests ...

Get Mastering Angular Components now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.