Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Better clarify the difference between toIncludeAllMembers and toIncludeSameMembers in the documentation #609

Open
rdsedmundo opened this issue May 31, 2023 · 0 comments

Comments

@rdsedmundo
Copy link

Feature Request
Description:
Only by reading the names is not very straightforward to reason about the difference immediately, specially when the description of toIncludeAllMembers mentions the same members.

The difference as I understand is this:

expect([1, 2, 3]).toIncludeSameMembers([1, 2, 3]); // passes, as array elements are equal, extra elements are not allowed
expect([1, 2, 3, 4]).toIncludeAllMembers([1, 2, 3]); // passes, even though there's an extra 4, it also contains [1, 2, 3]

Possible solution:

  • Improve the description text, emphasizing that for toIncludeSameMembers no extra values are allowed.
  • Add negative test cases (e.g using .not) instead of just positive examples.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
1 participant