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

feat: add a '.toIncludeSamePartialMembers()' custom matcher #697

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

npwork
Copy link

@npwork npwork commented Aug 9, 2024

What

Added new custom matcher toIncludeSamePartialMembers

Why

Currently only toIncludeAllPartialMembers available to match array with partial members but unfortunately you can't assert that only specified members are present.

Example:

expect([{ hello: 'world' }, { foo: 'bar', baz: 'qux' }]).toIncludeAllPartialMembers([{ foo: 'qux' }])

This assertion will pass but how can I assert that only 1 partial member with foo: 'qux' present?

For that I've added toIncludeSamePartialMembers which behaves as a toIncludeSameMembers but for partial members.

Notes

Housekeeping

  • Unit tests
  • Documentation is up to date
  • No additional lint warnings
  • Typescript definitions are added/updated where relevant

Copy link

changeset-bot bot commented Aug 9, 2024

⚠️ No Changeset found

Latest commit: a884c9f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sam-super
Copy link

I was just coming to this repo to start on this feature - nice one!

@npwork
Copy link
Author

npwork commented Sep 25, 2024

@sam-super I wish maintainer could review this :/

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants