Skip to content
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

Merged
merged 4 commits into from Jan 21, 2018

Conversation

nivsherf
Copy link
Contributor

@nivsherf nivsherf commented Jan 16, 2018

Add match.every and match.some as requested in issue #1624.

Steps to verify:

  1. npm install
  2. npm test

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.
Copy link
Member

@mroderick mroderick left a 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.

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));
Copy link
Member

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.

@nivsherf
Copy link
Contributor Author

Thanks for your feedback @mroderick. Edited the tests and added documentation for the new matchers.

@mroderick mroderick merged commit c5dfaae into sinonjs:master Jan 21, 2018
@mroderick
Copy link
Member

This has caused tests in IE11 for master to fail. I am investigating. Once we have figured out what the error is caused by, I'll push a fix and we can get this shipped.

@mroderick mroderick added the semver:minor changes will cause a new minor version label Jan 21, 2018
@mroderick
Copy link
Member

This has been released as sinon@4.2.0.

@mroderick mroderick mentioned this pull request Jan 21, 2018
mroderick added a commit to mroderick/sinon that referenced this pull request Jan 21, 2018
This would have prevented the failing build in master that occurred
after merging sinonjs#1661, which would have allowed the author to fix it.
mantoni pushed a commit that referenced this pull request Jan 21, 2018
This would have prevented the failing build in master that occurred
after merging #1661, which would have allowed the author to fix it.
franck-romano pushed a commit to franck-romano/sinon that referenced this pull request Oct 1, 2019
* 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.
franck-romano pushed a commit to franck-romano/sinon that referenced this pull request Oct 1, 2019
This would have prevented the failing build in master that occurred
after merging sinonjs#1661, which would have allowed the author to fix it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:minor changes will cause a new minor version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants