TIL: How to Correctly Use a Jasmine Spy
At Gaslight we are all about continuously growing and learning, so we’re starting a “Today I Learned Series”! Stay tuned for more tidbits!
TIL: How to correctly use a Jasmine Spy:
Foo = require('foo') describe 'Foo' describe 'bar' it 'does a thing' spyOn(Foo, 'bar') foo = new Foo() expect(foo.bar).toHaveBeenCalled()
no method error? Try
- Spies are a type of test double that allow you to stub functions and track the function call, and it’s arguments
For more information on Jasmine Spies, visit their documentation.