MtoContainKey
Bun

method

test.Matchers.toContainKey

expected: unknown
): void;

Asserts that an object contains a key.

The value must be an object

@param expected

the expected value

expect({ a: 'foo', b: 'bar', c: 'baz' }).toContainKey('a');
expect({ a: 'foo', b: 'bar', c: 'baz' }).toContainKey('b');
expect({ a: 'foo', b: 'bar', c: 'baz' }).toContainKey('c');
expect({ a: 'foo', b: 'bar', c: 'baz' }).not.toContainKey('d');