Mock database client functions in get-profiles tests to return resolved values; add projection field in test queries; comment out debug log in get-profiles implementation.

This commit is contained in:
MartinBraquet
2026-07-29 22:47:01 +02:00
parent c7b552ac43
commit 9612028e2c
2 changed files with 4 additions and 3 deletions

View File

@@ -797,7 +797,7 @@ export const loadProfiles = async (props: profileQueryType, db?: SupabaseDirectC
}
}
console.debug('profiles:', profiles)
// console.debug('profiles:', profiles)
const countQuery = renderSql(select(`count(*) as count`), ...tableSelection, ...filters)

View File

@@ -75,8 +75,8 @@ describe('loadProfiles', () => {
beforeEach(() => {
jest.clearAllMocks()
mockPg = {
map: jest.fn(),
one: jest.fn(),
map: jest.fn().mockResolvedValue([]),
one: jest.fn().mockResolvedValue(0),
}
jest.spyOn(supabaseInit, 'createSupabaseDirectClient').mockReturnValue(mockPg)
@@ -93,6 +93,7 @@ describe('loadProfiles', () => {
limit: 10,
name: 'John',
is_smoker: true,
projection: 'full' as const,
}
;(mockPg.map as jest.Mock).mockResolvedValue([])