Skip to content

The agent that grows with you

test(desktop): opt voice conversation sibling tests into read-aloud TTS

Hermes Agent5dcfd72a968e
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation-boundary.test.tsx b/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation-boundary.test.tsx
index aad96a26099..9a3ad72a9e7 100644
--- a/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation-boundary.test.tsx
+++ b/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation-boundary.test.tsx
@@ -3,6 +3,7 @@ import { afterEach, expect, it, vi } from 'vitest'
import { type ChatMessage, collectUnspokenTurnSpeech } from '@/lib/chat-messages'
import { stopVoicePlayback } from '@/lib/voice-playback'
+import { $autoSpeakReplies } from '@/store/voice-prefs'
import { useVoiceConversation } from './use-voice-conversation'
@@ -51,6 +52,7 @@ class TestAudio extends EventTarget {
}
afterEach(() => {
+ $autoSpeakReplies.set(false)
cleanup()
stopVoicePlayback()
vi.useRealTimers()
@@ -59,6 +61,9 @@ afterEach(() => {
})
it('speaks a sealed narration while busy and keeps the session open for the final reply', async () => {
+ // This test drives the TTS playback path, gated by the read-aloud toggle
+ // (#44263); opt in like the app does when replies are spoken.
+ $autoSpeakReplies.set(true)
vi.useFakeTimers()
TestAudio.instances = []
vi.stubGlobal('Audio', TestAudio)
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation-rearm.test.tsx b/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation-rearm.test.tsx
index 049495d58f0..49a364d9eb0 100644
--- a/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation-rearm.test.tsx
+++ b/apps/desktop/src/app/chat/composer/hooks/use-voice-conversation-rearm.test.tsx
@@ -1,7 +1,8 @@
import { act, cleanup, renderHook, waitFor } from '@testing-library/react'
-import { afterEach, describe, expect, it, vi } from 'vitest'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { $voicePlayback } from '@/store/voice-playback'
+import { $autoSpeakReplies } from '@/store/voice-prefs'
import { useVoiceConversation } from './use-voice-conversation'
@@ -205,7 +206,15 @@ async function beginReply(hook: ReturnType<typeof renderRearmConversation>) {
}
describe('useVoiceConversation playback rearm', () => {
+ beforeEach(() => {
+ // These tests exercise the TTS playback paths, which the read-aloud
+ // toggle gates in useVoiceConversation (#44263); opt in like the app
+ // does when replies are spoken.
+ $autoSpeakReplies.set(true)
+ })
+
afterEach(() => {
+ $autoSpeakReplies.set(false)
cleanup()
vi.clearAllMocks()
mocks.resetSpeechMocks()