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

x/unitest/matcher/to_start_with.ts>toStartWith

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

Use .toStartWith when checking if a String starts with a given String prefix

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

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

test("passes when value is starts with given string", () => {
  expect("hello world").toStartWith("hello");
  expect("hello world").not.toStartWith("world");
});

Parameters

actual: string
prefix: string