toMatchObject

Bun

Symbol

Matchers.toMatchObject

toMatchObject(subset: object): void

Asserts that an object matches a subset of properties.

@param subset

Subset of properties to match with.

expect({ a: 1, b: 2 }).toMatchObject({ b: 2 });
expect({ c: new Date(), d: 2 }).toMatchObject({ d: 2 });