Top "Sinon" questions

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

Testing private members in Javascript using Sinon

I'm starting to write some javascript tests and trying to figure out what the best approach is for inspecting the …

javascript testing mocha sinon
How to mock a function inside another function (which I am testing) using sinon?

let's say i have a function Func a() { //Do Something let c = b(); return c; } I want to test the …

javascript function mocking mocha sinon
mock method calling callback function sinon

How do you mock an outer method calling a callback using sinon? Example given the following code, getText should return …

javascript sinon
Testing routers in backbone.js properly?

So I've just started to write tests for my in-progress javascript app, using sinon.js & jasmine.js. Works pretty …

javascript backbone.js jasmine sinon
Nodejs: Testing with sinon and async/await

Having trouble getting this test to run using sinon and async/await. Here is an example of what I'm doing: // …

javascript node.js async-await sinon
How to mock an axios request using sinon modules

There seems to be so many different ways to do this, but I am trying to use just sinon, sinon-test, …

javascript node.js axios sinon sinon-chai
sinon.stub() vs sinon.sandbox.stub()?

Using sinon and sinon-qunit in our front end unit tests, and I'm struggling to understand the difference in these methods. …

javascript unit-testing qunit sinon
Use SinonJS to stub and spy on the same function?

In the following example, I want to stub the get function to prevent the actual HTTP request from occurring. I …

mocha 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 called with certain …

javascript unit-testing sinon sinon-chai
Is it possible to stub out or spy on the setState method in React when doing unit tests?

I have the following function in my component: method(args) { fetch(args) .then((response) => { this.setState({ element: response error: …

unit-testing reactjs sinon enzyme