Skip to content

Commit f54a3d1

Browse files
authored
test: all flaky unit tests (calcom#26558)
1 parent 2d19003 commit f54a3d1

3 files changed

Lines changed: 41 additions & 1 deletion

File tree

packages/app-store/_utils/payments/handlePaymentSuccess.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ vi.mock("@calcom/lib/logger", () => ({
7474
})),
7575
},
7676
}));
77+
// Mock routing-forms modules to prevent async import issues during test teardown
78+
vi.mock("@calcom/features/routing-forms/lib/findFieldValueByIdentifier", () => ({
79+
findFieldValueByIdentifier: vi.fn(),
80+
}));
81+
vi.mock("@calcom/app-store/routing-forms/lib/findFieldValueByIdentifier", () => ({
82+
findFieldValueByIdentifier: vi.fn(),
83+
}));
7784

7885
import { getBooking } from "@calcom/features/bookings/lib/payment/getBooking";
7986
import getWebhooks from "@calcom/features/webhooks/lib/getWebhooks";

packages/features/bookings/lib/EventManager.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@ import { prisma } from "@calcom/prisma/__mocks__/prisma";
22

33
import { describe, expect, it, vi, beforeEach } from "vitest";
44

5+
vi.mock("@calcom/features/watchlist/lib/utils/normalization", () => ({
6+
normalizeEmail: vi.fn(),
7+
extractDomainFromEmail: vi.fn(),
8+
normalizeDomain: vi.fn(),
9+
}));
10+
vi.mock("@calcom/features/watchlist/lib/service/GlobalBlockingService", () => ({
11+
GlobalBlockingService: vi.fn(),
12+
}));
13+
vi.mock("@calcom/features/watchlist/lib/freeEmailDomainCheck/checkIfFreeEmailDomain", () => ({
14+
checkIfFreeEmailDomain: vi.fn(),
15+
}));
16+
vi.mock("@calcom/features/watchlist/operations/check-if-users-are-blocked.controller", () => ({
17+
checkIfUsersAreBlocked: vi.fn(),
18+
}));
19+
vi.mock("@calcom/features/watchlist/lib/telemetry", () => ({
20+
sentrySpan: vi.fn(),
21+
}));
22+
523
import { CredentialRepository } from "@calcom/features/credentials/repositories/CredentialRepository";
624
import { symmetricDecrypt } from "@calcom/lib/crypto";
725
import type { DestinationCalendar } from "@calcom/prisma/client";

packages/features/crmManager/crmManager.test.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
import { mockCrmApp } from "@calcom/web/test/utils/bookingScenario/bookingScenario";
22

33
import type { TFunction } from "i18next";
4-
import { describe, expect, test, vi } from "vitest";
4+
import { describe, expect, test, vi, afterEach } from "vitest";
5+
6+
vi.mock("@calcom/app-store/salesforce/lib/graphql/SalesforceGraphQLClient", () => ({
7+
SalesforceGraphQLClient: vi.fn(),
8+
}));
9+
vi.mock("@calcom/app-store/salesforce/lib/CrmService", () => ({
10+
default: vi.fn(),
11+
}));
12+
vi.mock("@urql/core", () => ({
13+
Client: vi.fn(),
14+
cacheExchange: vi.fn(),
15+
fetchExchange: vi.fn(),
16+
}));
17+
vi.mock("@urql/exchange-retry", () => ({
18+
retryExchange: vi.fn(),
19+
}));
520

621
import { getCrm } from "@calcom/app-store/_utils/getCrm";
722

0 commit comments

Comments
 (0)