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