Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/unitest/matcher/to_include_any_members.ts>toIncludeAnyMembers

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