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

x/unitest/matcher/to_contain.ts>toContain

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

Use .toContain when you want to check that an item is in an array

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

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

Parameters

actual: Iterable<unknown>
expected: Primitive