The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(human): cover realtime mode and live voice state
Steven Enamakel3857030a395c
diff --git a/app/src/features/human/HumanPage.realtimeMode.test.tsx b/app/src/features/human/HumanPage.realtimeMode.test.tsxindex ba6730d7b4..77b134c9a0 100644--- a/app/src/features/human/HumanPage.realtimeMode.test.tsx+++ b/app/src/features/human/HumanPage.realtimeMode.test.tsx@@ -8,7 +8,7 @@* voiceEntry.test.ts). LiveVoiceControls is stubbed so no socket or mic opens.*/import { configureStore } from '@reduxjs/toolkit';-import { render, screen } from '@testing-library/react';+import { fireEvent, render, screen } from '@testing-library/react';import { Provider } from 'react-redux';import { MemoryRouter } from 'react-router-dom';import { beforeEach, describe, expect, it, vi } from 'vitest';@@ -36,7 +36,9 @@ vi.mock('../../utils/config', async importOriginal => {});vi.mock('./LiveVoiceControls', () => ({- default: () => <div data-testid="live-voice-controls-stub" />,+ default: ({ onPhaseChange }: { onPhaseChange?: (phase: string) => void }) => (+ <button data-testid="live-voice-controls-stub" onClick={() => onPhaseChange?.('listening')} />+ ),}));// Render the slot props so the test observes what the card would actually show,@@ -65,7 +67,8 @@ vi.mock('./Mascot', async importOriginal => {};});-vi.mock('./useHumanMascot', () => ({ useHumanMascot: () => ({ face: 'idle', visemes: [] }) }));+const useHumanMascot = vi.fn((_opts: unknown) => ({ face: 'idle', visemes: [] }));+vi.mock('./useHumanMascot', () => ({ useHumanMascot: (opts: unknown) => useHumanMascot(opts) }));vi.mock('./Mascot/manifest/useMascotManifest', () => ({useMascotManifest: () => ({ manifest: null, entry: null, loading: false, error: null }),}));@@ -132,4 +135,11 @@ describe('HumanPage — voice entry point', () => {await renderPage();expect(screen.getAllByTestId('live-voice-controls-stub')).toHaveLength(1);});++ it('silences speak-replies and shows the listening pose while a live session runs', async () => {+ await renderPage();+ expect(useHumanMascot).toHaveBeenLastCalledWith({ speakReplies: true, listening: false });+ fireEvent.click(screen.getByTestId('live-voice-controls-stub'));+ expect(useHumanMascot).toHaveBeenLastCalledWith({ speakReplies: false, listening: true });+ });});diff --git a/app/src/store/mascotSlice.liveVoice.test.ts b/app/src/store/mascotSlice.liveVoice.test.tsnew file mode 100644index 0000000000..58206fba35--- /dev/null+++ b/app/src/store/mascotSlice.liveVoice.test.ts@@ -0,0 +1,33 @@+import { REHYDRATE } from 'redux-persist';+import { describe, expect, it } from 'vitest';++import mascotReducer, {+ selectChatMascotLiveVoicePhase,+ setChatMascotLiveVoicePhase,+} from './mascotSlice';++describe('mascotSlice — live voice phase', () => {+ it('defaults to off', () => {+ const state = mascotReducer(undefined, { type: '@@init' });+ expect(selectChatMascotLiveVoicePhase({ mascot: state })).toBe('off');+ });++ it('tracks the phase and coerces unknown values to off', () => {+ let state = mascotReducer(undefined, setChatMascotLiveVoicePhase('speaking'));+ expect(state.chatMascotLiveVoicePhase).toBe('speaking');+ const same = mascotReducer(state, setChatMascotLiveVoicePhase('speaking'));+ expect(same).toBe(state);+ state = mascotReducer(state, setChatMascotLiveVoicePhase('bogus' as never));+ expect(state.chatMascotLiveVoicePhase).toBe('off');+ });++ it('is never restored from a persisted blob', () => {+ const live = mascotReducer(undefined, setChatMascotLiveVoicePhase('listening'));+ const rehydrated = mascotReducer(live, {+ type: REHYDRATE,+ key: 'mascot',+ payload: { chatMascotLiveVoicePhase: 'speaking' },+ });+ expect(rehydrated.chatMascotLiveVoicePhase).toBe('off');+ });+});