Skip to main content
Module

x/unitest/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/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();
});