Top "Sinon" questions

Sinon is a mocking framework for JavaScript, which can create spies, stubs and mocks.

How to mock/replace getter function of object with Jest?

In Sinon I can do the following: var myObj = { prop: 'foo' }; sinon.stub(myObj, 'prop').get(function getterFn() { return 'bar'; }); …

javascript reactjs mocking sinon jestjs
How do I use Sinon with Typescript?

If I use sinon with typescript then how do I cast the sinon mock to an instance of my object? …

unit-testing typescript sinon
Sinon JS "Attempted to wrap ajax which is already wrapped"

I got the above error message when I ran my test. Below is my code (I'm using Backbone JS and …

testing backbone.js jasmine sinon
Test if function is called react and enzyme

I am trying to test one of the methods in my react component. It is being called after a button …

reactjs sinon enzyme
How to Unit Test React-Redux Connected Components?

I am using Mocha, Chai, Karma, Sinon, Webpack for Unit tests. I followed this link to configure my testing environment …

unit-testing reactjs mocha sinon redux
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.…

javascript mocha sinon stubbing
How to stub a Typescript-Interface / Type-definition?

I work with Typescript on an AngularJS 1.X project. I use different Javascript libraries for different purposes. To unit-test my …

javascript angularjs typescript sinon stubbing
How do I stub new Date() using sinon?

I want to verify that various date fields were updated properly but I don't want to mess around with predicting …

javascript testing sinon stub
Stubbing and/or mocking a class in sinon.js?

I've created a database wrapper for my application, shown below. To test it, I obviously would like to replace the …

javascript node.js sinon
Understanding Sinon.js's yield(), yields(), and callsArg()

What is the difference between stub.yield([arg1, arg2, ...]) spy.yields([arg1, arg2, ...]) stub.callsArg(index) in the Sinon.js …

javascript sinon