Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 aSet
sinon.match.set.deepEquals(set)
- Requires aSet
to be deep equal another onesinon.match.set.contains(set)
- Requires aSet
to contain each one of the items the givenset
has.This also adds tests for each matcher and updates the docs.
Background (Problem in detail)
As it happens with
Map
elements, theorder
of elements does not mean anything in aSet
and there's no way to know an item's index. This is why this PR does not includestartsWith
andendsWith
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
andArrays
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
npm install
npm run test
- This will run the newly created testsIf 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 ❤️