Skip to main content
Module

x/unitest/mod.ts>toContainValues

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

Use .toContainValues when checking if an object contains all of the provided values

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

const expect = defineExpect({
  matcherMap: {
    toContainValues,
  },
  modifierMap: {
    not,
  },
});

test("passes when object contains all of the given values", () => {
  const object = { a: "foo", b: "bar", c: "baz" };
  expect(object).toContainValues(["foo"]);
  expect(object).toContainValues(["baz", "bar"]);
  expect(object).not.toContainValues(["qux", "foo"]);
});

Parameters

actual: object
expected: readonly unknown[]