Unit testing is a key tool for ensuring the correctness of our software. Angular apps are no exception! In fact, part of what makes Angular so amazing is that it is a framework written from the ground up with testing in mind.
If you haven't unit tested an Angular application before, you might not be aware that there are some extra features that we can use to make testing easier, such as hooking into Angular's dependency injection, and using angular-mocks for a range of test-friendly utilities.
In this Coffee Break Course, designed to teach a new skill or concept in a single sitting, Envato Tuts+ instructor Dan Wellman will show you how to take an existing Angular app and add tests for its controller. You'll learn how to create a new scope and how to create an instance of the controller and associate it with that scope. You'll also see how to inject dependencies and how to stub methods in dependencies.
Watch the other Coffee Break Courses in the Angular testing series:
- Testing Angular Directives
- Testing Angular Services
- Testing Angular Filters
- Testing Angular Components
1. Testing Angular Controllers