mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-22 19:18:47 +08:00
Add unit tests for various components and stores in the terminal dashboard
- Implement tests for AssociationHighlight, DashboardToolbar, QueuePanel, SessionGroupTree, and TerminalDashboardPage to ensure proper functionality and state management. - Create tests for cliSessionStore, issueQueueIntegrationStore, queueExecutionStore, queueSchedulerStore, sessionManagerStore, and terminalGridStore to validate state resets and workspace scoping. - Mock necessary dependencies and state management hooks to isolate tests and ensure accurate behavior.
This commit is contained in:
37
ccw/frontend/src/stores/sessionManagerStore.test.ts
Normal file
37
ccw/frontend/src/stores/sessionManagerStore.test.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
// ========================================
|
||||
// Session Manager Store Tests
|
||||
// ========================================
|
||||
|
||||
import { beforeEach, describe, expect, it } from 'vitest';
|
||||
import { useSessionManagerStore } from './sessionManagerStore';
|
||||
|
||||
describe('sessionManagerStore', () => {
|
||||
beforeEach(() => {
|
||||
useSessionManagerStore.getState().resetState();
|
||||
});
|
||||
|
||||
it('resetState clears workspace-scoped terminal metadata and selection', () => {
|
||||
const store = useSessionManagerStore.getState();
|
||||
|
||||
store.createGroup('Workspace Group');
|
||||
store.setActiveTerminal('session-1');
|
||||
store.updateTerminalMeta('session-1', {
|
||||
title: 'Session 1',
|
||||
status: 'active',
|
||||
alertCount: 2,
|
||||
tag: 'workspace-a',
|
||||
});
|
||||
|
||||
const activeState = useSessionManagerStore.getState();
|
||||
expect(activeState.groups).toHaveLength(1);
|
||||
expect(activeState.activeTerminalId).toBe('session-1');
|
||||
expect(activeState.terminalMetas['session-1']?.status).toBe('active');
|
||||
|
||||
store.resetState();
|
||||
|
||||
const nextState = useSessionManagerStore.getState();
|
||||
expect(nextState.groups).toEqual([]);
|
||||
expect(nextState.activeTerminalId).toBeNull();
|
||||
expect(nextState.terminalMetas).toEqual({});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user