From c12d0c08982b9b80eedc018421dde44d70438f98 Mon Sep 17 00:00:00 2001 From: Dries Augustyns Date: Tue, 9 Dec 2025 15:23:48 +0100 Subject: [PATCH] test: Correctly mock STRIPE_ENABLED --- .../__tests__/BillingLimitService.test.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/api/src/services/__tests__/BillingLimitService.test.ts b/apps/api/src/services/__tests__/BillingLimitService.test.ts index e4fa25b..1d0ff1c 100644 --- a/apps/api/src/services/__tests__/BillingLimitService.test.ts +++ b/apps/api/src/services/__tests__/BillingLimitService.test.ts @@ -5,15 +5,28 @@ import {EmailService} from '../EmailService'; import {factories, getPrismaClient} from '../../../../../test/helpers'; import {redis} from '../../database/redis'; -// Mock STRIPE_ENABLED to be true for free tier tests +// Mock STRIPE_ENABLED and STRIPE_SK for free tier tests vi.mock('../../app/constants.js', async () => { const actual = await vi.importActual('../../app/constants.js'); return { ...actual, STRIPE_ENABLED: true, + STRIPE_SK: 'sk_test_mock_key_for_testing', }; }); +// Mock the stripe client to avoid actual Stripe API calls +vi.mock('../../app/stripe.js', () => ({ + stripe: { + customers: { + retrieve: vi.fn().mockResolvedValue({ + deleted: false, + currency: 'usd', + }), + }, + }, +})); + describe('BillingLimitService - Critical Enforcement', () => { let projectId: string; let contactId: string;