jest-extended
jest-extended copied to clipboard
feat: add a '.toIncludeSamePartialMembers()' custom matcher
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
- [x] Unit tests
- [x] Documentation is up to date
- [x] No additional lint warnings
- [x] Typescript definitions are added/updated where relevant
⚠️ No Changeset found
Latest commit: aaaf9c30205c5b132bc67dddbc5d30d92f70feb4
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
I was just coming to this repo to start on this feature - nice one!
@sam-super I wish maintainer could review this :/
I'll take a look.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 100.00%. Comparing base (
ecbc78e) to head (aaaf9c3). Report is 1 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #697 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 74 75 +1
Lines 808 829 +21
Branches 252 312 +60
=========================================
+ Hits 808 829 +21
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Thanks for the PR! Sorry it took so long. I plan to increase up my involvement with this project.