From bd2325126cf7984d1fbd49768eb284cca57e1db6 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sun, 24 May 2026 16:35:15 +0200 Subject: [PATCH] Fix jest tests --- backend/api/src/get-profiles.ts | 2 +- backend/api/tests/unit/get-profiles.unit.test.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/api/src/get-profiles.ts b/backend/api/src/get-profiles.ts index b73858bc..43011dfd 100644 --- a/backend/api/src/get-profiles.ts +++ b/backend/api/src/get-profiles.ts @@ -153,7 +153,7 @@ const EXCLUDED_PROFILE_COLS = new Set(['search_text', 'search_tsv']) let profileCols: any -const getProfileCols = async () => { +export const getProfileCols = async () => { if (profileCols) return profileCols const pg = createSupabaseDirectClient() const rows = await pg.manyOrNone<{column_name: string}>( diff --git a/backend/api/tests/unit/get-profiles.unit.test.ts b/backend/api/tests/unit/get-profiles.unit.test.ts index 7e69792b..e885cfc0 100644 --- a/backend/api/tests/unit/get-profiles.unit.test.ts +++ b/backend/api/tests/unit/get-profiles.unit.test.ts @@ -6,6 +6,7 @@ import * as sqlBuilder from 'shared/supabase/sql-builder' describe('getProfiles', () => { beforeEach(() => { jest.clearAllMocks() + jest.spyOn(profilesModule, 'getProfileCols').mockResolvedValue(null) }) afterEach(() => { @@ -77,6 +78,7 @@ describe('loadProfiles', () => { } jest.spyOn(supabaseInit, 'createSupabaseDirectClient').mockReturnValue(mockPg) + jest.spyOn(profilesModule, 'getProfileCols').mockResolvedValue(null) }) afterEach(() => { jest.restoreAllMocks()