Skip to main content
Module

x/unitest/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/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