toContainAnyKeys

Bun

Symbol

Matchers.toContainAnyKeys

toContainAnyKeys(expected: unknown): void

Asserts that an object contains at least one of the provided keys. Asserts that an object contains all the provided keys.

The value must be an object

@param expected

the expected value

expect({ a: 'hello', b: 'world' }).toContainAnyKeys(['a']);
expect({ a: 'hello', b: 'world' }).toContainAnyKeys(['b']);
expect({ a: 'hello', b: 'world' }).toContainAnyKeys(['b', 'c']);
expect({ a: 'hello', b: 'world' }).not.toContainAnyKeys(['c']);