We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const query = Model.find(conditions, fields, options); if (someCondition) { query.populate('someField) } query.exec(callback);
Trying to test populate is called
sinon.mock(Model) .expects('find') .chain('populate).withArgs('someField') .chain('exec') .yields(null, { foo: 'bar' });
I get the following error:
Uncaught TypeError: Cannot read property 'emit' of undefined
If I remove the chain for 'populate' it works just fine.
Debugging further it looks like the yields is not returning the mock object causing a failure further in the test.
The text was updated successfully, but these errors were encountered:
Looks like I can modify the code to reassign the query as a work around.
let query = Model.find(conditions, fields, options); if (someCondition) { query = query.populate('someField) } query.exec(callback);
Sorry, something went wrong.
No branches or pull requests
Trying to test populate is called
I get the following error:
Uncaught TypeError: Cannot read property 'emit' of undefined
If I remove the chain for 'populate' it works just fine.
Debugging further it looks like the yields is not returning the mock object causing a failure further in the test.
The text was updated successfully, but these errors were encountered: