jest-extended
jest-extended copied to clipboard
feat: add .toBeJsonMatching(expectation) matcher
What
This adds support for a new custom matcher .toBeJsonMatching(...)
.
Why
This matcher is useful when one wants to check that a function has been called with a JSON string that satisfies some constraints,
expect(fn).toHaveBeenCalledWith(
expect.toBeJsonMatching({ key1: 'value1' })
);
Housekeeping
- [x] Unit tests
- [x] Documentation is up to date
- [x] No additional lint warnings
- [x] Typescript definitions are added/updated where relevant