From 942df9d3621a7baa06a77ea57662442d4d048e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E9=98=BF=E6=B1=9F=28Relakkes?= =?UTF-8?q?=29?= Date: Thu, 9 Apr 2026 00:46:25 +0800 Subject: [PATCH] fix: update tests for multi-tab architecture Co-Authored-By: Claude Opus 4.6 (1M context) --- desktop/src/__tests__/pages.test.tsx | 30 +++++++++++++++++-- .../src/components/chat/chatBlocks.test.tsx | 2 +- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/desktop/src/__tests__/pages.test.tsx b/desktop/src/__tests__/pages.test.tsx index d9f6f374..5a3f7479 100644 --- a/desktop/src/__tests__/pages.test.tsx +++ b/desktop/src/__tests__/pages.test.tsx @@ -12,6 +12,7 @@ import { ToolInspection } from '../pages/ToolInspection' // Layout components (chrome is now here, not in pages) import { AppShell } from '../components/layout/AppShell' +import { Sidebar } from '../components/layout/Sidebar' import { UserMessage } from '../components/chat/UserMessage' import { useChatStore } from '../stores/chatStore' import { useTabStore } from '../stores/tabStore' @@ -36,12 +37,37 @@ describe('Content-only pages render without errors', () => { }) it('ActiveSession renders with chat components', () => { + const SESSION_ID = 'test-active-session' + useTabStore.setState({ tabs: [{ sessionId: SESSION_ID, title: 'Test', status: 'idle' }], activeTabId: SESSION_ID }) + useChatStore.setState({ + sessions: { + [SESSION_ID]: { + messages: [], + chatState: 'idle', + connectionState: 'connected', + streamingText: '', + streamingToolInput: '', + activeToolUseId: null, + activeToolName: null, + activeThinkingId: null, + pendingPermission: null, + tokenUsage: { input_tokens: 0, output_tokens: 0 }, + elapsedSeconds: 0, + statusVerb: '', + slashCommands: [], + elapsedTimer: null, + }, + }, + }) const { container } = render() // Should have the title area and chat input expect(container.innerHTML).toContain('Untitled Session') // ChatInput has a textarea expect(container.querySelector('textarea')).toBeInTheDocument() expect(container.innerHTML).not.toContain('Preview') + // Cleanup + useTabStore.setState({ tabs: [], activeTabId: null }) + useChatStore.setState({ sessions: {} }) }) it('ActiveSession shows a single primary action button while a turn is active', () => { @@ -123,11 +149,11 @@ describe('Chat attachments', () => { describe('AppShell layout renders chrome', () => { it('AppShell renders sidebar and session shell', () => { - const { container } = render() + const { container } = render() expect(container.querySelector('aside')).toBeInTheDocument() expect(container.innerHTML).toContain('New session') expect(container.innerHTML).toContain('Scheduled') - expect(container.innerHTML).toContain('Select a project') + expect(container.innerHTML).toContain('All projects') }) }) diff --git a/desktop/src/components/chat/chatBlocks.test.tsx b/desktop/src/components/chat/chatBlocks.test.tsx index 21517d0b..1b5d13fa 100644 --- a/desktop/src/components/chat/chatBlocks.test.tsx +++ b/desktop/src/components/chat/chatBlocks.test.tsx @@ -108,6 +108,6 @@ describe('chat blocks', () => { expect(container.textContent).toContain('Allow') // react-diff-viewer-continued uses styled-components tables that don't // fully render in jsdom, so we verify the DiffViewer wrapper is mounted - expect(container.querySelector('[class*="rounded-lg"]')).toBeTruthy() + expect(container.querySelector('[class*="rounded-[var(--radius-lg)]"]')).toBeTruthy() }) })