Matcher for part of object properties
See original GitHub issueIt’d be cool to have a matcher for a subset of object properties. Eg.:
expect({a: 1, b: 2, c: 3}).toContainSubset({a: 1, c: 3})
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:11 (9 by maintainers)
Top Results From Across the Web
How to check for object properties match for an object using ...
I want to write a test case that checks if the object has the tree property named accordingly and their value is number,...
Read more >Jest Array/Object partial match with objectContaining and ...
It's possible to do partial matches on Arrays and Objects in Jest using expect. objectContaining and expect. arrayContaining .
Read more >Matching Properties and Values in the Object challenge.
In this post let's make a function that looks through an array of objects (first argument) and returns an array of all objects...
Read more >Matching Object Properties | Fabrication Products
The Match Object(s) Properties command allows the user to copy selected properties from one Item and paste them to other single or multiple ......
Read more >Jest partial matching on objects, arrays and functions
We can do this using Jest's partial matchers. In this post I will cover: Using Jest's objectContaining to match on certain key/value pairs...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@all-contributors please add @krzysztof-jelski for ideas
I’d prefer something grammatically correct. So definitely
toBeAContainerWith
andtoBeAnArrayWith
overtoBeContainerWith
andtoBeArrayWith
. I’d also propose renamingtoBeAContainerWith
totoContain