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

x/unitest/matcher/mod.ts>toBeNil

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

Use .toBeNil when checking a value is null or undefined

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

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

test("passes when value is null or undefined", () => {
  expect(null).toBeNil();
  expect(undefined).toBeNil();
  expect(true).not.toBeNil();
});

Parameters

actual: unknown