Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/unitest/matcher/mod.ts>toHaveBeenCalledAfter

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

Use .toHaveBeenCalledAfter when checking if a mock object was called after another mock object

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

const expect = defineExpect({
  matcherMap: {
    toHaveBeenCalledAfter,
  },
});

test("calls mockObject1 after mockObject2", () => {
  const mockObject1 = fn();
  const mockObject2 = fn();

  mockObject2();
  mockObject1();
  mockObject2();

  expect(mockObject1).toHaveBeenCalledAfter(mockObject2);
});

Parameters

unnamed 0: MockObject
expected: MockObject