expect icon indicating copy to clipboard operation
expect copied to clipboard

`expect.any`

Open v1rtl opened this issue 4 years ago • 0 comments

Would be nice to have expect.any to test if objects have proper types for a large set of properties (e.g. obj.x is a number)

ref: https://jestjs.io/docs/expect#expectanyconstructor

jest/expect code: https://github.com/facebook/jest/blob/e0b33b74b5afd738edc183858b5c34053cfc26dd/packages/expect/src/asymmetricMatchers.ts#L22

possible implementation:

expect.any = (val) => {
  if (typeof val === 'number' || val instanceof Number) return '...'
}

v1rtl avatar Sep 20 '21 10:09 v1rtl