jest-extended icon indicating copy to clipboard operation
jest-extended copied to clipboard

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

Open npwork opened this issue 1 year ago • 3 comments

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

npwork avatar Aug 09 '24 09:08 npwork

⚠️ 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

changeset-bot[bot] avatar Aug 09 '24 09:08 changeset-bot[bot]

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

sam-super avatar Sep 25 '24 08:09 sam-super

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

npwork avatar Sep 25 '24 08:09 npwork

I'll take a look.

keeganwitt avatar May 03 '25 03:05 keeganwitt

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.

codecov[bot] avatar May 03 '25 23:05 codecov[bot]

Thanks for the PR! Sorry it took so long. I plan to increase up my involvement with this project.

keeganwitt avatar May 04 '25 02:05 keeganwitt