How to check mocked function is called? #5547
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It could be something like this: - apolloQuery: () => { return Promise.resolve(); }
+ apolloQuery: vi.fn(() => { return Promise.resolve(); }) import { apolloQuery } from "@/api";
vi.mock("@/api", ...);
it("...", () => {
// do something with apolloQuery ...
// then assert
expect(apolloQuery).toHaveBeenCalled()
}) |
Beta Was this translation helpful? Give feedback.
It could be something like this: