test(desktop): voice boundary test partial-mocks @/hermes and @/api/client

main went red after ae7bf98971 (voice playback threads the Bot owner scope
through api/client::ownerScoped) met 96cb6636d3 (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:
teknium1
2026-09-20 12:17:45 -07:00
committed by Teknium
parent 7f21c7dcc7
commit 08c4063ff4

View File

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