Slide 21
Slide 21 text
Testing in Angular
• Plenty of guides on the mechanics of testing a controller, directive,
service, etc.
• Very easy to mock dependencies
var $modalInstance = jasmine.createSpyObj('$modalInstance', [
'close',
'dismiss'
]);
module(function ($provide) {
$provide.value('$modalInstance', $modalInstance);
});
...
expect($modalInstance.close).toHaveBeenCalled()
• Rarely need async tests ($timeout.flush(), $httpBackend.flush())