JohanObrink / mongoose-mock

MIT License
34 stars 23 forks source link

Does not support fluent schema queries #8

Open dnlsngr opened 9 years ago

dnlsngr commented 9 years ago

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);

robhawkes commented 9 years ago

This would be really useful for my use-case too

hpgmiskin commented 8 years ago

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

blugavere commented 7 years ago

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