Skip to content

The agent that grows with you

test(tui): move the wake voice-mode test into a topical sibling

Tekniumf82376022819
diff --git a/ui-tui/src/__tests__/createGatewayEventHandler.test.ts b/ui-tui/src/__tests__/createGatewayEventHandler.test.ts
index e03cfc6be77..0f48af0132a 100644
--- a/ui-tui/src/__tests__/createGatewayEventHandler.test.ts
+++ b/ui-tui/src/__tests__/createGatewayEventHandler.test.ts
@@ -1215,20 +1215,6 @@ describe('createGatewayEventHandler', () => {
expect(ctx.voice.setVoiceEnabled).toHaveBeenCalledWith(true)
})
- it('turns on the shared owner\'s per-session voice mode, not the sidecar flag, before a wake capture', async () => {
- const ctx = buildCtx([])
- ;(ctx.gateway.gw as any).isCanonical = true
- patchUiState({ sid: 'owner-session' })
-
- createGatewayEventHandler(ctx)({ payload: { start_new_session: false }, type: 'wake.detected' } as any)
-
- await vi.waitFor(() =>
- expect(ctx.gateway.rpc).toHaveBeenCalledWith('voice.record', { action: 'start', session_id: 'owner-session' })
- )
- expect(ctx.gateway.gw.request).toHaveBeenCalledWith('slash.exec', { command: 'voice on', session_id: 'owner-session' })
- expect(ctx.gateway.rpc).not.toHaveBeenCalledWith('voice.toggle', expect.anything())
- })
-
it('keeps the current session when wake detection disables session creation', async () => {
const ctx = buildCtx([])
patchUiState({ sid: 'current-session' })
diff --git a/ui-tui/src/__tests__/createGatewayEventHandler.wake.test.ts b/ui-tui/src/__tests__/createGatewayEventHandler.wake.test.ts
new file mode 100644
index 00000000000..5afd4bda701
--- /dev/null
+++ b/ui-tui/src/__tests__/createGatewayEventHandler.wake.test.ts
@@ -0,0 +1,31 @@
+import { beforeEach, expect, it, vi } from 'vitest'
+
+import { createGatewayEventHandler } from '../app/createGatewayEventHandler.js'
+import { patchUiState, resetUiState } from '../app/uiStore.js'
+
+// T9: a shared-owner session's voice mode is the owner's per-session /voice state, the one
+// voice.record gates on; the sidecar's voice.toggle flips only its process-global flag.
+
+beforeEach(() => resetUiState())
+
+it('turns on the shared owner\'s per-session voice mode, not the sidecar flag, before a wake capture', async () => {
+ const request = vi.fn(async () => null)
+ const rpc = vi.fn(async () => null)
+
+ const ctx = {
+ composer: { setInput: vi.fn() },
+ gateway: { gw: { isCanonical: true, request }, rpc },
+ session: { colsRef: { current: 80 }, newSession: vi.fn() },
+ submission: { submitRef: { current: vi.fn() } },
+ system: { sys: vi.fn() },
+ transcript: { appendMessage: vi.fn(), panel: vi.fn(), setHistoryItems: vi.fn() },
+ voice: { setProcessing: vi.fn(), setRecording: vi.fn(), setVoiceEnabled: vi.fn() }
+ } as any
+
+ patchUiState({ sid: 'owner-session' })
+ createGatewayEventHandler(ctx)({ payload: { start_new_session: false }, type: 'wake.detected' } as any)
+
+ await vi.waitFor(() => expect(rpc).toHaveBeenCalledWith('voice.record', { action: 'start', session_id: 'owner-session' }))
+ expect(request).toHaveBeenCalledWith('slash.exec', { command: 'voice on', session_id: 'owner-session' })
+ expect(rpc).not.toHaveBeenCalledWith('voice.toggle', expect.anything())
+})