Wrapping Up

AngularJS has been designed from the ground up for testability. AngularJS and angular-mocks interplay to facilitate the testing of client-side code written using AngularJS. The test suites can inject test doubles for the dependencies that the controllers need. Also, by tactfully mocking the back end, the behavior of the client-side JavaScript was fully verified using automated scripts. We did not have to bring up the server or create any HTML pages to get the code tested.

The AngularJS team has learned a great deal from the active use of the AngularJS 1.x framework. As a total rewrite, Angular 2 is vastly different from AngularJS 1.x. In projects where you currently use AngularJS 1.x you can use the techniques presented in this chapter. ...

Get Test-Driving JavaScript Applications 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.