Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add ability to match/assert on all the args at once #67

Merged
merged 1 commit into from
Apr 30, 2021

Conversation

timkindberg
Copy link
Owner

@timkindberg timkindberg commented Apr 30, 2021

  • New when.allArgs matcher. Instructs jest-when to hand over the full set of arguments to the matcher. This allows a dev to perform more complex matches, or in some cases write more succinct matching logic.

Closes #66

@mcous Can you please review and see if this might meet your needs? I have one test in particular that address your specific use case.

Still needs:

  • Documentation

src/when.test.js Show resolved Hide resolved
src/when.js Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Apr 30, 2021

Codecov Report

Merging #67 (3e7805b) into master (ea49d39) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 3e7805b differs from pull request most recent head 7163307. Consider uploading reports for the commit 7163307 to get more accurate results
Impacted file tree graph

@@            Coverage Diff            @@
##            master       #67   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          108       116    +8     
=========================================
+ Hits           108       116    +8     
Impacted Files Coverage Δ
src/when.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea49d39...7163307. Read the comment docs.

@timkindberg
Copy link
Owner Author

@mcous I'm really liking this feature! Check out the documentation changes I made.

Copy link

@mcous mcous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs look great! And yeah, I like that this solution combines generality with a little bit of an extra hoop to jump through to prevent misuse or overuse

README.md Show resolved Hide resolved
- New when.allArgs matcher. Instructs jest-when to hand over the full set of arguments to the matcher. This allows a dev to perform more complex matches, or in some cases write more succinct matching logic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: allow partial argument matches
3 participants