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

x/unitest/matcher/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/matcher/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