Sinon: How To Stub An Entire Class, Rather Than Just A Method
I have a class under test that creates instances of another class. I want to stub out the entirety of the second class, so that its constructor never gets called. For example, If
Solution 1:
In sinon documentation:
If you want to create a stub object of MyConstructor, but don’t want the constructor to be invoked, use this utility function.
var stub = sinon.createStubInstance(MyConstructor)
http://sinonjs.org/releases/v1.17.7/stubs/
Post a Comment for "Sinon: How To Stub An Entire Class, Rather Than Just A Method"