Skip to main content
Module

x/unitest/mod.ts>toIncludeAnyMembers

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

Use .toIncludeAnyMembers when checking if an array contains any of the members of a given set

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

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

test("passes when given array values match any of the members in the set", () => {
  expect([1, 2, 3]).toIncludeAnyMembers([2, 1, 3]);
  expect([1, 2, 2]).toIncludeAnyMembers([2]);
  expect([1, 2, 2]).not.toIncludeAnyMembers([3]);
});

Parameters

actual: readonly unknown[]
expected: readonly unknown[]