Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/unitest/matcher/to_match_object.ts>toMatchObject

🃏 Deno-first universal unit testing framework
Latest
function toMatchObject
import { toMatchObject } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/to_match_object.ts";

Use .toMatchObject to check that a object matches a subset of the properties of an object

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

test("passes when object is part of subset", () => {
  expect({ foo: "bar", hello: "world" }).toMatchObject({ foo: "bar" });
});

Parameters

actual: object
expected: Record<PropertyKey, unknown>