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_nth_called_with.ts>toHaveBeenNthCalledWith

🃏 Deno-first universal unit testing framework
Latest
function toHaveBeenNthCalledWith
import { toHaveBeenNthCalledWith } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/to_have_been_nth_called_with.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[]