-
-
Notifications
You must be signed in to change notification settings - Fork 769
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
Add match.every and match.some (#1624) #1661
Conversation
Added new matcher - match.every, which matches on an object or iterable if all of the properties (or elements, respectively) match the given predicate.
Added new matcher - match.some, which matches on an object or iterable if some of the properties (or elements, respectively) match the given predicate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very nice pull request!
For the code, I only have the one comment about preferring refute
over assert.isFalse
.
Would you mind adding documentation for the new methods?
There's docs/CONTRIBUTING.md
to get you started on the right foot.
test/match-test.js
Outdated
it("fails to match anything that is not an object or an iterable", function () { | ||
var every = sinonMatch.every(sinonMatch.any); | ||
|
||
assert.isFalse(every.test(1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using assert.isFalse
, you can use refute
... you just have to import it from referee
at the top of the file.
Switching to refute in match.every and match.some tests
Thanks for your feedback @mroderick. Edited the tests and added documentation for the new matchers. |
This has caused tests in IE11 for |
This has been released as |
This would have prevented the failing build in master that occurred after merging sinonjs#1661, which would have allowed the author to fix it.
This would have prevented the failing build in master that occurred after merging #1661, which would have allowed the author to fix it.
* Add match.every (sinonjs#1624) Added new matcher - match.every, which matches on an object or iterable if all of the properties (or elements, respectively) match the given predicate. * Add match.some (sinonjs#1624) Added new matcher - match.some, which matches on an object or iterable if some of the properties (or elements, respectively) match the given predicate.
This would have prevented the failing build in master that occurred after merging sinonjs#1661, which would have allowed the author to fix it.
Add match.every and match.some as requested in issue #1624.
Steps to verify: