toHaveLength

Bun

Symbol

MatchersBuiltin.toHaveLength

toHaveLength(length: number): void

Asserts that a value has a .length property that is equal to the expected length.

@param length

the expected length

expect([]).toHaveLength(0);
expect("hello").toHaveLength(4);