Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/unitest/matcher/to_have_been_called_with.ts>toHaveBeenCalledWith

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

Use .toHaveBeenCalledWith to ensure that a mock function was called with specific arguments

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

test("passes when mock object called with arg", () => {
  const mockObject = fn();
  mockObject(1, 2, 3);
  expect(mockObject).toHaveBeenCalledWith(1, 2, 3);
});

Parameters

unnamed 0: MockObject
...expected: readonly unknown[]