Jest Array/Object partial match with objectContaining and arrayContaining · Code with Hugo

added by JavaScript Kicks
10/29/2019 10:10:04 AM

185 Views

It's possible to do partial matches on Arrays and Objects in Jest using expect.objectContaining and expect.arrayContaining. expect has some powerful matcher methods to do things like the above partial matches. Using Jest at an advanced level means using tools like these to write tests that are better isolated and less brittle (this is what I'm tryin to achieve with the Jest Handbook).


0 comments