Skip to content

assertcheck v1.0.0


assertcheck / assert / elementsMatch

Function: elementsMatch()

ts
function elementsMatch<T>(
   a, 
   b, 
   opts?): void;

Defined in: src/assert.ts:1050

Asserts that the two arrays have the same elements regardless of order. Uses _.sortBy for a deterministic comparison (works with objects).

Type Parameters

Type Parameter
T

Parameters

ParameterType
aT[]
bT[]
opts?Opts

Returns

void

Example

ts
`assert.elementsMatch(result, expected, "wrong set of ids")`

Released under the Apache 2.0 License. Built by Vagabond Studio — senior-only for growing companies.