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

feat: add .toBeJsonMatching(expectation) matcher

Open Belema opened this issue 1 year ago • 0 comments

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

Belema avatar Aug 02 '22 17:08 Belema