-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
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
Problems on chaining count with where in array plus limit #35
Comments
Hi @kolbma, could you post the complete example? (including test and the code being tested) |
@gaguirre, //service-under-test.js
function updateClients(logger, tenant, user, clients) {
...
// check if the client exists first...
clients.forEach( ( client) => {
DbCollection.findOne({tenant: tenant, clientID: client.clientID}).lean().then((result)=> {...});
})
...
}
module.exports = { updateClients: updateClients }; //service-under-test.test.js
it('should not error just because of multiple calls', () => {
sinon.mock(DbCollection).expects('findOne').chain('lean').resolves(someVal);
service.updateClients(logger, 'uk-en', user, [{clientID; 'a', newVal: ...}, {clientID: 'b', newVal: ...}];
...
}); On running this test, I get the following error:
Hope that helps? |
@gaguirre - I'm on the latest version - |
Just ran into sandbox.mock(Notification)
.expects('findOne').twice()
.chain('cache').twice()
.chain('exec').twice()
.resolves({}); |
How do I chain this?
I've tried
Result:
I've also tried different chain orders.
I've also tried with
chaining also where and in and again different order combinations.
Doesn't work.
The text was updated successfully, but these errors were encountered: