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

x/unitest/matcher/mod.ts>toHaveBeenCalledBefore

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

Use .toHaveBeenCalledBefore when checking if a mock object was called before another mock object

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

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

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

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

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

Parameters

unnamed 0: MockObject
expected: MockObject