Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(human): cover chat mascot dock rendering

Steven Enamakel473999d940c6
diff --git a/app/src/features/human/chatMascot/ChatMascotDock.test.tsx b/app/src/features/human/chatMascot/ChatMascotDock.test.tsx
index fc7fa1e189..3f4d2fe8b7 100644
--- a/app/src/features/human/chatMascot/ChatMascotDock.test.tsx
+++ b/app/src/features/human/chatMascot/ChatMascotDock.test.tsx
@@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest';
import { selectChatMascotDismissed, selectChatMascotExpanded } from '../../../store/mascotSlice';
import { renderWithProviders } from '../../../test/test-utils';
-import { ChatMascotProvider } from './ChatMascotContext';
+import { type ChatMascotContextValue, ChatMascotProvider, useChatMascot } from './ChatMascotContext';
import ChatMascotDock from './ChatMascotDock';
const renderDock = (expanded = false, dismissed = false) =>
@@ -39,6 +39,28 @@ describe('ChatMascotDock', () => {
expect(selectChatMascotExpanded(store.getState())).toBe(true);
});
+ it('asks the stage to start a live voice session on click', () => {
+ let ctx: ChatMascotContextValue | null = null;
+ const Probe = () => {
+ ctx = useChatMascot();
+ return null;
+ };
+ renderWithProviders(
+ <ChatMascotProvider>
+ <Probe />
+ <ChatMascotDock />
+ </ChatMascotProvider>,
+ { preloadedState: { mascot: { chatMascotExpanded: false } } }
+ );
+ expect(ctx!.consumeVoiceStart()).toBe(false);
+
+ fireEvent.click(screen.getByTestId('chat-mascot-dock'));
+
+ expect(ctx!.consumeVoiceStart()).toBe(true);
+ // Consumed once: a later stage mount must not reopen the mic on its own.
+ expect(ctx!.consumeVoiceStart()).toBe(false);
+ });
+
it('draws nothing itself — the shared overlay paints over this slot', () => {
// Guards the single-Rive-instance invariant: if the dock ever grows its own
// mascot, the app loads the `.riv` twice and the travel becomes a crossfade.