I get how to stub Mongoose models (thanks to Stubbing a Mongoose model with Sinon), but I don\'t quite understand how to stub calls like:
myModel.findOne({\"
If you use Promise, you can try sinon-as-promised:
sinon.stub(Mongoose.Model, 'findOne').returns({ exec: sinon.stub().rejects(new Error('pants')) //exec: sinon.stub(). resolves(yourExepctedValue) });