-
Notifications
You must be signed in to change notification settings - Fork 108
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
Allow making assertions on a sequence of calls #75
Comments
What Sinon assertion does this correspond to? |
Sinon doesn't have this feature out of the box. Basically I'll be adding the |
Since Sinon doesn't have this feature, Sinon Chai should not. You should just use a series of assertions, instead of inventing a DSL. |
The series of assertions would look like this: var visitor = sinon.spy();
[1,2].forEach(visitor);
expect(visitor.getCall(0).args[0]).to.equal(1);
expect(visitor.getCall(1).args[0]).to.equal(2); which is much less readable and more error prone. The purpose of a matcher library like Chai is to abstract away such implementation details in favor of well-described expectations. Why should the fact that this feature doesn't correspond to a function of Sinon mean that Sinon-Chai shouldn't expose it? |
For future reference, if anyone's interested, I ended up implementing this in a complementary plugin: |
I'd like to propose a feature to support the following:
If you're for it, I can try to contribute via PR
The text was updated successfully, but these errors were encountered: