14 July 2017
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.
Heads up! This article may make reference to the Gaslight team—that's still us! We go by Launch Scout now, this article was just written before we re-introduced ourselves. Find out more here.