Skip to main content
Module

x/unitest/mod.ts>toBeInstanceOf

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

Use .toBeInstanceOf to check that an object is an instance of a class

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

test("passes when value is instance of class", () => {
  class A {}
  expect(new A()).toBeInstanceOf(A);
  expect(() => {}).toBeInstanceOf(Function);
  expect(new A()).not.toBeInstanceOf(Function);
});

Parameters

actual: unknown
expected: Function