Top "Sinon" questions

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

How do you mock MySQL (without an ORM) in Node.js?

I'm using Node.js with felixge's node-mysql client. I am not using an ORM. I'm testing with Vows and want …

mysql node.js mocking vows sinon
Mocking JavaScript constructor with Sinon.JS

I'd like to unit test the following ES6 class: // service.js const InternalService = require('internal-service'); class Service { constructor(args) { this.…

javascript node.js unit-testing mocking sinon
How to mock e.preventDefault in react component's child

Hy, I don't know how to mock an inline function in React component's child My stack: sinon, chai, enzyme; Component …

unit-testing reactjs mocha sinon enzyme
How to properly unit test jQuery's .ajax() promises using Jasmine and/or Sinon?

I've got a fairly straightforward function which returns a jQuery .ajax() promise as such: CLAW.controls.validateLocation = function(val, $inputEl) { …

unit-testing jquery jasmine sinon
How to write test that mocks the $route object in vue components

I have a component that contains statement like this.$route.fullPath, how should I mock value of fullPathof $route object …

unit-testing sinon vue-component vuejs2 vue-loader
stubbing a function using jest

is there a way to stub a function using jest API? I'm used to working with sinon stub, where I …

unit-testing mocking jestjs sinon
When using Sinon, how to replace stub function in a stub instance?

If I have create a instance by var a = sinon.createStubInstance(MyContructor). How can I replace one of the stubbed …

node.js mocha sinon nodeunit
Reset "called" Count on Sinon Spy

How do I reset the "called" count on a Sinon spy before each test? Here's what I'm doing now: beforeEach(…

javascript unit-testing mocha sinon chai
Mocking Window with Sinon, Mocha, Enzyme, and React

I'm trying to mock out the window object for a component I'm using with just the four libraries listed above. …

unit-testing reactjs mocha sinon
Stub out a jQuery selector call?

I'm trying to get better at unit testing my JavaScript. I have the following code: var categoryVal = $('#category').val(); …

javascript jquery unit-testing jasmine sinon