Skip to main content
Module

x/unitest/mod.ts>toContainEqual

🃏 Deno-first universal unit testing framework
Latest
function toContainEqual
Re-export
import { toContainEqual } from "https://deno.land/x/unitest@v1.0.0-beta.82/mod.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>