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

x/unitest/matcher/to_be_instance_of.ts>toBeInstanceOf

๐Ÿƒ Deno-first universal unit testing framework
Latest
function toBeInstanceOf
import { toBeInstanceOf } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/to_be_instance_of.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