This lesson is for PRO members.

Unlock this lesson NOW!
Already subscribed? sign in

Inject Jasmine Spies With $provide

1:49 Angular 1.x lesson by

One of the beautiful things about dependency injection in your AngularJS apps is the ability to replace dependencies in your unit tests. In this lesson Trevor looks at how to configure Jasmine spies as injectable replacements for dependencies for testing.

Get the Code Now
click to level up

egghead.io comment guidelines

Avatar
egghead.io

One of the beautiful things about dependency injection in your AngularJS apps is the ability to replace dependencies in your unit tests. In this lesson Trevor looks at how to configure Jasmine spies as injectable replacements for dependencies for testing.

Avatar
Albert

Question:

In the test "expect($scope.favoriteBooks).toEqual(favoriteBooks)", what is the relationship between this line of code and the profileSvcSpy? In other words: how is the connection between the controller and the service being tested?

Thx. -Albert

In reply to egghead.io
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?