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

x/unitest/modifier/mod.ts>number

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

Use .number to convert any actual to number. Internally, the Number constructor is used.

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

const expect = defineExpect({
  matcherMap: {
    toBe,
  },
  modifierMap: {
    number,
  },
});

test("passes when numberized value to be", () => {
  expect("").number.toBe(0);
  expect("test").number.toBe(NaN);
});