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);
});