Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Avoid mock leakage

François Zaninotto9fe0c1e724b6
diff --git a/src/components/atomic-crm/providers/commons/getContactAvatar.spec.ts b/src/components/atomic-crm/providers/commons/getContactAvatar.spec.ts
index 6c9b0232..69d8bb99 100644
--- a/src/components/atomic-crm/providers/commons/getContactAvatar.spec.ts
+++ b/src/components/atomic-crm/providers/commons/getContactAvatar.spec.ts
@@ -2,11 +2,12 @@ import { fetchWithTimeout } from "../../misc/fetchWithTimeout";
import type { Contact, EmailAndType } from "../../types";
import { getContactAvatar, hash } from "./getContactAvatar";
-vi.mock("../../misc/fetchWithTimeout", () => ({
- fetchWithTimeout: vi.fn(),
-}));
-
describe("getContactAvatar", () => {
+ beforeAll(() => {
+ vi.mock("../../misc/fetchWithTimeout", () => ({
+ fetchWithTimeout: vi.fn(),
+ }));
+ });
afterAll(() => {
vi.resetAllMocks();
});