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

x/unitest/matcher/to_contain_any_values.ts>toContainAnyValues

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

Use .toContainAnyValues when checking if an object contains at least one of the provided values

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

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

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

Parameters

actual: object
expected: readonly unknown[]