test(desktop): poll for 'listening' after re-arm in voice rearm tests
status flips to 'listening' only after handle.start() resolves, so the synchronous assertion right after waitFor(start x2) raced (2/9 flakes on 'speaks completed fallback sentences before the response finishes'). Wrap it in waitFor; same assertion, no longer timing-dependent.
This commit is contained in:
@@ -235,7 +235,8 @@ describe('useVoiceConversation playback rearm', () => {
|
||||
})
|
||||
|
||||
await waitFor(() => expect(mocks.handle.start).toHaveBeenCalledTimes(2))
|
||||
expect(hook.result.current.status).toBe('listening')
|
||||
// status flips to 'listening' only after start() resolves — poll for it.
|
||||
await waitFor(() => expect(hook.result.current.status).toBe('listening'))
|
||||
})
|
||||
|
||||
it('honors Stop while streaming playback is still preparing', async () => {
|
||||
@@ -301,7 +302,8 @@ describe('useVoiceConversation playback rearm', () => {
|
||||
})
|
||||
)
|
||||
await waitFor(() => expect(mocks.handle.start).toHaveBeenCalledTimes(2))
|
||||
expect(hook.result.current.status).toBe('listening')
|
||||
// status flips to 'listening' only after start() resolves — poll for it.
|
||||
await waitFor(() => expect(hook.result.current.status).toBe('listening'))
|
||||
})
|
||||
|
||||
it('speaks completed fallback sentences before the response finishes', async () => {
|
||||
@@ -327,7 +329,8 @@ describe('useVoiceConversation playback rearm', () => {
|
||||
})
|
||||
)
|
||||
await waitFor(() => expect(mocks.handle.start).toHaveBeenCalledTimes(2))
|
||||
expect(hook.result.current.status).toBe('listening')
|
||||
// status flips to 'listening' only after start() resolves — poll for it.
|
||||
await waitFor(() => expect(hook.result.current.status).toBe('listening'))
|
||||
})
|
||||
|
||||
it('does not play the next fallback sentence or re-arm after Stop', async () => {
|
||||
|
||||
Reference in New Issue
Block a user