toContainAllKeys

Bun

Symbol

MatchersBuiltin.toContainAllKeys

toContainAllKeys(expected: unknown): void

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' }).toContainAllKeys(['a','b']);
expect({ a: 'hello', b: 'world' }).toContainAllKeys(['b','a']);
expect({ 1: 'hello', b: 'world' }).toContainAllKeys([1,'b']);
expect({ a: 'hello', b: 'world' }).not.toContainAllKeys(['c']);
expect({ a: 'hello', b: 'world' }).not.toContainAllKeys(['a']);