Skip to main content

@rbxts/expect > Assertion > containExactly

Assertion.containExactly() method

Asserts that the array contains all of the values in expectedValues, and nothing more or less.

Signature:

containExactly(expectedValues: InferArrayElement<T>[]): this;

Parameters

Parameter

Type

Description

expectedValues

InferArrayElement<T>[]

An array of elements that the actual array should be.

Returns:

this

Remarks

Order doesn't matter, so long as the actual array has the same values as the expected array.

There shouldn't be any extra elements in the actual array either; both arrays should deeply contain the same elements, with no regard to the ordering of elements.

Example

expect([1,2,3]).to.containExactly([2,1,3]);
expect([1,2]).to.not.containExactly([1,2,3]);
expect([1,2,3]).to.not.containExactly([1,2]);