mongoose-mock icon indicating copy to clipboard operation
mongoose-mock copied to clipboard

Does not support fluent schema queries

Open dnlsngr opened this issue 9 years ago • 3 comments

http://isaac.su/2014/05/mocking-fluent-objects-in-javascript/

Looking for a tool that will give me a drop-in mock for a schema-based query using fluent syntax. This tool lacks the recursive aspect necessary for that.

e.g. schema.find().where('name').equals('John').exec(callback);

dnlsngr avatar Mar 24 '15 23:03 dnlsngr

This would be really useful for my use-case too

robhawkes avatar Apr 08 '15 10:04 robhawkes

Hello I found sinon-mongoose which seems to let you test chained mongoose queries if that helps

hpgmiskin avatar Feb 18 '16 19:02 hpgmiskin

the methods are missing, (like, lean), etc - but for chaining you can Model.find.returns(Model) within the test case, leveraging the sinon stub api to achieve what you're looking for

blugavere avatar Nov 19 '16 17:11 blugavere