toContain

Bun

Symbol

Matchers.toContain

toContain(expected: unknown): void

Asserts that a value contains what is expected.

The value must be an array or iterable, which includes strings.

@param expected

the expected value

expect([1, 2, 3]).toContain(1);
expect(new Set([true])).toContain(true);
expect("hello").toContain("o");