You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm happy user of sinon-mongoose 2.2.1 and find it very usefull. It worked just fine until sinon 7.2.3, which was not compatible with created sandbox (sinon.createSandbox) but was compatible with default sandbox.
Starting version 7.2.6 sinon-mongoose is not compatible nor with default nor with created sanbox (sandbox.createSandbox).
describe('using sinon createSandbox',function(){varsanbox=sinon.createSandbox();beforeEach(function(){sanbox.restore();});afterEach(function(){sanbox.verify();});it('should work mocking Model',function(){varBookMock=sanbox.mock(Book);BookMock.expects('find').withArgs('SOME_ARGUMENTS').chain('exec').resolves('RESULT');Book.find('SOME_ARGUMENTS').exec().then(function(result){assert.equal(result,'RESULT');});});});
It fails with error:
2) sinon-mongoose
using sinon sandbox
should work mocking Model:
TypeError: BookMock.expects(...).withArgs(...).chain is not a function
at Context.<anonymous> (test/index.js:159:10)
The text was updated successfully, but these errors were encountered:
mauron85
changed the title
Not sinon.createSandbox compatible (chain is not a function)
Not compatible with [email protected] default or createSandbox (chain is not a function)
Mar 3, 2019
Yes, it's still relevant. You can try against provided test, which is basically same as in your suite, but using sinon.createSandbox() instead of default one.
EDIT: I've updated issue. Removed claim about not working with default sandbox, because I must first check, if it's just sinon version incompatibility or if mongoose is involved too. However claim about not working with sinon.createSandbox() is valid.
I am facing the same error with sinon-mongoose 7.3.2. I am a first-time of sinon-mongoose. What are the earlier versions of sinon-mongoose and sinon where they both work together? I would like to revert to them until maybe there is a solution.
Hi there,
I'm happy user of sinon-mongoose 2.2.1 and find it very usefull.
It worked just fine until sinon 7.2.3, which was not compatible with created sandbox (sinon.createSandbox) but was compatible with default sandbox.Starting version 7.2.6 sinon-mongoose is not compatible nor with default nor with created sanbox (sandbox.createSandbox).I know there is #15 and also PR #19.
EDIT: added test for non default sandbox.
It fails with error:
The text was updated successfully, but these errors were encountered: