Skip to main content
Module

x/unitest/mod.ts>toBeOneOf

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