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

x/unitest/matcher/to_be_even.ts>toBeEven

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

Use .toBeEven when checking if a value is an even Number

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

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

test("passes when value is an even number", () => {
  expect(2).toBeEven();
  expect(1).not.toBeEven();
  expect(NaN).not.toBeEven();
});

Parameters

actual: number