toContainEqual

Bun

Symbol

Matchers.toContainEqual

toContainEqual(expected: unknown): void

Asserts that a value contains and equals what is expected.

This matcher will perform a deep equality check for members of arrays, rather than checking for object identity.

@param expected

the expected value

expect([{ a: 1 }]).toContainEqual({ a: 1 });
expect([{ a: 1 }]).not.toContainEqual({ a: 2 });