Skip to main content
Module

x/unitest/mod.ts>toInclude

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

Use .toInclude when checking if a string includes the given string substring

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

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

test("passes when value includes substring", () => {
  expect("hello world").toInclude("ell");
  expect("hello world").not.toInclude("bob");
});

Parameters

actual: string
substring: string