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

x/unitest/matcher/mod.ts>toHaveBeenCalled

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

Use .toHaveBeenCalled to ensure that a mock object got called

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

test("passes when mock object called", () => {
  const mockObject = fn();
  expect(mockObject).not.toHaveBeenCalled();
  mockObject();
  expect(mockObject).toHaveBeenCalled();
});

Parameters

unnamed 0: MockObject