import sinon from 'sinon'; describe('example test', () => { it('should call function with exactly given parameters', () => { const fooStub = sinon.stub().returns('bar'); fooStub(123, 'abc'); sinon.assert.calledWithExactly(fooStub, 123, 'abc'); }); });
import sinon from 'sinon'; describe('example test', () => { it('should call function with exactly given parameters', () => { const fooSpy = sinon.spy(); fooSpy('test'); sinon.assert.calledWithExactly(fooSpy, 'test'); }); });
npm install sinon --save-dev