@rbxts/expect > Assertion > some
Assertion.some() method
Asserts that at least one element in the array satisfies the specified Filter.
Signature:
some(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(["Daymon", "Bryan"]).to.have.some("starts with bry", it => startsWith(it, "Bry"));
expect([1,3,5]).to.not.have.some("are even", it => it % 2 === 0);
Example message:
Expected '[1,2,3]' to NOT have any elements that are even, but it did at index '2'
Value of [2]: '2'