Skip to main content

@rbxts/expect > Assertion > deepEqual

Assertion.deepEqual() method

Asserts that the value is deep equal to the expectedValue.

Signature:

deepEqual<R = T>(expectedValue: R): Assertion<R>;

Parameters

Parameter

Type

Description

expectedValue

R

Returns:

Assertion<R>

Remarks

The deep equal comparison is done via the rbxts-deep-equal library, and supports most roblox data types, as well as nested tables and recursive self references.

Will check for missing keys, different types, different values, reference types, and so forth; throwing a unique message depending on the context.

Can also be used to compare arrays, and other objects.

Example

expect([1,2,3]).to.deepEqual([1,2,3]);
expect({
name: "daymon",
age: 24
children: [{
name: "michael",
age: 4
}]
}).to.deepEqual({
name: "daymon",
age: 24
children: [{
name: "michael",
age: 4
}]
});