Skip to main content
Module

x/unitest/mod.ts>toHaveBeenNthCalledWith

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

Use .toHaveBeenNthCalledWith to test mock object was nth 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("tomato");
  mockObject("potato");
  expect(mockObject).toHaveBeenNthCalledWith(1, "tomato");
  expect(mockObject).toHaveBeenNthCalledWith(2, "potato");
});

Parameters

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