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

x/unitest/matcher/to_contain_values.ts>toContainValues

🃏 Deno-first universal unit testing framework
Latest
function toContainValues
import { toContainValues } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/to_contain_values.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[]