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()