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

x/unitest/matcher/to_end_with.ts>toEndWith

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

Use .toEndWith when checking if a string ends with a given string suffix

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

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

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

Parameters

actual: string
suffix: string