@rbxts/expect > Assertion > all
Assertion.all() method
Asserts that all elements in the array satisfy the specified Filter.
Signature:
all(reason: string, condition: Filter<InferArrayElement<T>>): this;
Parameters
Parameter | Type | Description |
---|---|---|
reason | string | A reason to add at the end of the message for additional context. |
condition | A callback that returns |
Returns:
this
Example
expect(["Bryce", "Bryan"]).to.all('start with "Bry"', it => startsWith(it, "Bry"));
expect([1,3,4,5]).to.not.all('be even', it => it % 2 === 0);
Example message:
Expected '[1,2,3]' to all be even, but there was an element that failed the check
Index: 1
Value: '1'