test(desktop): voice boundary test partial-mocks @/hermes and @/api/client
main went red afterae7bf98971(voice playback threads the Bot owner scope through api/client::ownerScoped) met96cb6636d3(the new boundary test): the wholesale vi.mock of @/hermes drops setApiRequestProfile, which the profile-scope store reads at import, and the @/api/client mock lacks ownerScoped. Spread importOriginal() on both mocks so only the intended seams are faked.
This commit is contained in:
@@ -19,13 +19,18 @@ const mocks = vi.hoisted(() => ({
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('@/hermes', () => ({
|
||||
vi.mock('@/hermes', async importOriginal => ({
|
||||
...(await importOriginal<Record<string, unknown>>()),
|
||||
getApiRequestConnection: () => null,
|
||||
getApiRequestProfile: () => null,
|
||||
hermesApi: mocks.config,
|
||||
speakText: vi.fn()
|
||||
}))
|
||||
vi.mock('@/api/client', () => ({ profileScoped: (value: unknown) => value }))
|
||||
vi.mock('@/api/client', async importOriginal => ({
|
||||
...(await importOriginal<Record<string, unknown>>()),
|
||||
ownerScoped: (value: unknown) => value ?? {},
|
||||
profileScoped: (value: unknown) => value
|
||||
}))
|
||||
vi.mock('./use-mic-recorder', () => ({ useMicRecorder: () => ({ handle: mocks.mic, level: 0 }) }))
|
||||
vi.mock('@/lib/voice-barge-in', () => ({ monitorSpeechDuringPlayback: () => vi.fn() }))
|
||||
vi.mock('@/lib/thinking-sound', () => ({ startThinkingSound: vi.fn(), stopThinkingSound: vi.fn() }))
|
||||
|
||||
Reference in New Issue
Block a user