Skip to content Skip to sidebar Skip to footer
Showing posts with the label Sinon

Stub A Standalone Module.exports Function Using Rewire

I am trying to stub a module.exports function. But I have some trouble. I will give you a sudo code… Read more Stub A Standalone Module.exports Function Using Rewire

Stubbing Window.location.href With Sinon

I am trying to test some client-side code and for that I need to stub the value of window.location.… Read more Stubbing Window.location.href With Sinon

Has Been Called With Object Assertion

Function I'm spying on, receives object as an argument. I need to assert that the function been… Read more Has Been Called With Object Assertion

Sinon Stub With Es6-promisified Object

Ok my setup is as follows: Using node 6.2, es6-promisify, sinon, sinon-as-promised, and babel to tr… Read more Sinon Stub With Es6-promisified Object

Simple Way To Test Middleware In Express Without Creating Recreating Server?

I'd like to be able to stub my middleware functions on a per-test basis. The problem, as articu… Read more Simple Way To Test Middleware In Express Without Creating Recreating Server?

Stub Save Instance Method Of Mongoose Model With Sinon

I am trying to test a service function I use to save a widget using a Mongoose model. I want to stu… Read more Stub Save Instance Method Of Mongoose Model With Sinon