method Assert.prototype.propContains
Assert.prototype.propContains(
actual: unknown,
expected: unknown,
message?: string
): void

Asserts that actual contains all own enumerable properties from expected with matching values. Extra properties on actual are allowed and ignored.

Examples

Example 1

assert.propContains({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 });
assert.propContains(user, { role: "admin" });

Parameters

actual: unknown

The actual object (may have extra keys).

expected: unknown

The subset of key/value pairs that must be present.

optional
message: string

Optional failure message.

Return Type

void

Usage

import { Assert } from ".";