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

x/unitest/matcher/to_be_function.ts>toBeFunction

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

Use .toBeFunction when checking if a value is a Function

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

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

test("passes when value is a function", () => {
  expect(() => {}).toBeFunction();
  expect(function () {}).toBeFunction();
  expect(true).not.toBeFunction();
});

Parameters

actual: unknown