Calling Through
Learn how to use the callThrough and callFake methods.
We'll cover the following...
We'll cover the following...
A Jasmine object spy sits in front of the real object. When our test code calls a method on the underlying object, Jasmine will intercept that call and can take a number of actions. By default, Jasmine uses the stub strategy, which means it returns undefined and does not execute the underlying method.
We can also make use of the callThrough and callFake methods:
callThroughis used to forward a method call to the underlying object. The spy will record the method calls so we can make expectations in our test.
callFakeis used to intercept calls