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

x/unitest/matcher/mod.ts>toBePositive

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

Use .toBePositive when checking if a value is a positive number

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

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

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

Parameters

actual: number