Skip to main content
Module

x/unitest/mod.ts>toHaveBeenLastCalledWith

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

Use .toHaveBeenLastCalledWith to test mock object was last called with

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

test("passes when mock object of last called with", () => {
  const mockObject = fn();
  mockObject(1, 2, 3);
  mockObject(4, 5, 6);
  expect(mockObject).toHaveBeenLastCalledWith(4, 5, 6);
  expect(mockObject).not.toHaveBeenLastCalledWith(1, 2, 3);
});

Parameters

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