Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/unitest/matcher/to_contain_equal.ts>toContainEqual

๐Ÿƒ Deno-first universal unit testing framework
Latest
function toContainEqual
import { toContainEqual } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/to_contain_equal.ts";

Use .toContainEqual when you want to check that an item with a specific structure and values is contained in an array

import { expect, test } from "https://deno.land/x/unitest@$VERSION/mod.ts";

test("passes when array contains given value", () => {
  expect({ a: "foo", b: "bar" }).toContainEqual({ a: "foo" });
  expect({ a: "foo", b: "bar" }).not.toContainEqual({ c: "hoo" });
});

Parameters

actual: Record<PropertyKey, unknown>
expected: Record<PropertyKey, unknown>

Returns

MatchResult