Skip to main content

@rbxts/expect > Assertion > match

Assertion.match() method

Asserts that the actual value has the same properties and values as the expected.

Signature:

match<R extends object>(expected: R): Assertion<R & T>;

Parameters

Parameter

Type

Description

expected

R

Returns:

Assertion<R & T>

Remarks

Very similar to deepEqual, but this only applies one way; it doesn't fail if there are extra keys.

Can be used to only check a collection of certain keys and their respective values.

Example

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