toBeOneOf

Bun

Symbol

MatchersBuiltin.toBeOneOf

toBeOneOf(expected: unknown[] | Iterable<unknown, any, any>): void

Asserts that the value is deep equal to an element in the expected array.

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

@param expected

the expected value

expect(1).toBeOneOf([1,2,3]);
expect("foo").toBeOneOf(["foo", "bar"]);
expect(true).toBeOneOf(new Set([true]));