expect
expect copied to clipboard
`expect.any`
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 '...'
}