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

x/unitest/matcher/mod.ts>toBeFinite

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

Use .toBeFinite when checking if a value is a number, not NaN or Infinity

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

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

test("passes when value is a finite number", () => {
  expect(1).toBeFinite();
  expect(Infinity).not.toBeFinite();
  expect(NaN).not.toBeFinite();
});

Parameters

actual: unknown