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

x/unitest/matcher/to_be_one_of.ts>toBeOneOf

๐Ÿƒ Deno-first universal unit testing framework
Latest
function toBeOneOf
import { toBeOneOf } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/to_be_one_of.ts";

Use .toBeOneOf when checking if a value is a member of a given Array

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

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

test("passes when value is in given array", () => {
  expect(1).toBeOneOf([1, 2, 3]);
  expect(4).not.toBeOneOf([1, 2, 3]);
});

Parameters

actual: unknown
expected: readonly unknown[]