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

Sets matchers #1232

Merged
merged 4 commits into from
Jan 7, 2017
Merged

Sets matchers #1232

merged 4 commits into from
Jan 7, 2017

Conversation

lucasfcosta
Copy link
Member

@lucasfcosta lucasfcosta commented Jan 4, 2017

Purpose (TL;DR) - mandatory

As discussed on #1210 and #1215, this adds the following matchers for the Set type:

  • sinon.match.set(set) - Requires an object to be a Set
  • sinon.match.set.deepEquals(set) - Requires a Set to be deep equal another one
  • sinon.match.set.contains(set) - Requires a Set to contain each one of the items the given set has.

This also adds tests for each matcher and updates the docs.

Background (Problem in detail)

As it happens with Map elements, the order of elements does not mean anything in a Set and there's no way to know an item's index. This is why this PR does not include startsWith and endsWith matchers.

As we discussed on the PRs linked on the top of this description each one of these matchers work only for Set types and there are tests to ensure this.

The docs follow the same pattern as the docs for Maps and Arrays matchers in order for it to be consistent.

These tests were all ran in IE11 to make sure they would pass.

How to verify - mandatory

  1. Check out this branch (see github instructions below)
  2. npm install
  3. npm run test - This will run the newly created tests

If you desire any further changes please let me know and I'll happily commit them as soon as I can.
Once again, thanks for the awesome job you've been doing ❤️

@coveralls
Copy link

coveralls commented Jan 4, 2017

Coverage Status

Coverage decreased (-0.5%) to 94.906% when pulling 75575b3 on lucasfcosta:sets-matchers into a6d8e14 on sinonjs:master.

@fatso83 fatso83 merged commit 11edb2d into sinonjs:master Jan 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants