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

x/unitest/matcher/to_be_negative.ts>toBeNegative

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

Use .toBeNegative when checking if a value is a negative number

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

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

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

Parameters

actual: number