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

x/unitest/modifier/mod.ts>boolean

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

Use .boolean to convert any actual to boolean. Internally, the Boolean constructor is used.

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

const expect = defineExpect({
  matcherMap: {
    toBe,
  },
  modifierMap: {
    boolean,
  },
});

test("passes when booleanized value to be", () => {
  expect("").boolean.toBe(false);
  expect("test").boolean.toBe(true);
});

type

PreModifier<unknown, { actual: boolean; }>