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

x/unitest/matcher/mod.ts>toHaveLastReturnedWith

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

Use .toHaveLastReturnedWith to test the specific value that a mock object last returned

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

test("passes when mock object of last returned with", () => {
  const mockObject = fn((a: number, b: number) => a + b);
  mockObject(1, 2);
  mockObject(3, 4);
  expect(mockObject).toHaveLastReturnedWith(7);
});

Parameters

unnamed 0: MockObject
expected: unknown