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

x/unitest/matcher/mod.ts>toStartWith

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