toSatisfy

Bun

Symbol

Matchers.toSatisfy

toSatisfy(predicate: (value: T) => boolean): void

Checks whether a value satisfies a custom condition.

@param predicate

The custom condition to be satisfied. It should be a function that takes a value as an argument (in this case the value from expect) and returns a boolean.

expect(1).toSatisfy((val) => val > 0);
expect("foo").toSatisfy((val) => val === "foo");
expect("bar").not.toSatisfy((val) => val === "bun");