Files
Claude-Code-Workflow/ccw/frontend/src/stores/terminalPanelStore.test.ts
catlog22 9aa07e8d01 Add comprehensive tests for CLI functionality and CodexLens compatibility
- Introduced tests for stale running fallback in CLI watch functionality to ensure proper handling of saved conversations.
- Added compatibility tests for CodexLens CLI to verify index initialization despite compatibility conflicts.
- Implemented tests for Smart Search MCP usage to validate default settings and path handling.
- Created tests for UV Manager to ensure Python preference handling works as expected.
- Added a detailed guide for CCW/Codex commands and skills, covering core commands, execution modes, and templates.
2026-03-08 17:30:39 +08:00

36 lines
1.2 KiB
TypeScript

// ========================================
// Terminal Panel Store Tests
// ========================================
import { beforeEach, describe, expect, it } from 'vitest';
import { useTerminalPanelStore, selectTerminalCount } from './terminalPanelStore';
describe('terminalPanelStore', () => {
beforeEach(() => {
useTerminalPanelStore.getState().resetState();
});
it('resetState clears workspace-scoped terminal tabs and selection', () => {
const store = useTerminalPanelStore.getState();
store.openTerminal('session-a');
store.addTerminal('session-b');
store.setPanelView('queue');
const activeState = useTerminalPanelStore.getState();
expect(selectTerminalCount(activeState as any)).toBe(2);
expect(activeState.activeTerminalId).toBe('session-a');
expect(activeState.panelView).toBe('queue');
expect(activeState.isPanelOpen).toBe(true);
store.resetState();
const nextState = useTerminalPanelStore.getState();
expect(selectTerminalCount(nextState as any)).toBe(0);
expect(nextState.terminalOrder).toEqual([]);
expect(nextState.activeTerminalId).toBeNull();
expect(nextState.panelView).toBe('terminal');
expect(nextState.isPanelOpen).toBe(false);
});
});