mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +08:00
- Added Phase 6: Fix Discovery & Batching with intelligent grouping and batching of findings. - Added Phase 7: Fix Parallel Planning to launch planning agents for concurrent analysis and aggregation of partial plans. - Added Phase 8: Fix Execution for stage-based execution of fixes with conservative test verification. - Added Phase 9: Fix Completion to aggregate results, generate summary reports, and handle session completion. - Introduced new frontend components: ResizeHandle for draggable resizing of sidebar panels and useResizablePanel hook for managing panel sizes with localStorage persistence. - Added PowerShell script for checking TypeScript errors in source code, excluding test files.
124 lines
4.1 KiB
TypeScript
124 lines
4.1 KiB
TypeScript
// ========================================
|
|
// Queue Page Tests
|
|
// ========================================
|
|
// Tests for the issue queue page with i18n
|
|
|
|
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
import { render, screen } from '@/test/i18n';
|
|
import { QueuePage } from './QueuePage';
|
|
import { useWorkflowStore } from '@/stores/workflowStore';
|
|
import type { IssueQueue } from '@/lib/api';
|
|
|
|
// Mock queue data
|
|
const mockQueueData = {
|
|
tasks: ['task1', 'task2'],
|
|
solutions: ['solution1'],
|
|
conflicts: [],
|
|
execution_groups: ['group-1'],
|
|
grouped_items: { 'parallel-group': [] as any[] },
|
|
} satisfies IssueQueue;
|
|
|
|
// Mock hooks at top level
|
|
vi.mock('@/hooks', () => ({
|
|
useIssueQueue: () => ({
|
|
data: mockQueueData,
|
|
isLoading: false,
|
|
isFetching: false,
|
|
error: null,
|
|
refetch: vi.fn(),
|
|
}),
|
|
useQueueMutations: () => ({
|
|
activateQueue: vi.fn(),
|
|
deactivateQueue: vi.fn(),
|
|
deleteQueue: vi.fn(),
|
|
mergeQueues: vi.fn(),
|
|
isActivating: false,
|
|
isDeactivating: false,
|
|
isDeleting: false,
|
|
isMerging: false,
|
|
}),
|
|
}));
|
|
|
|
describe('QueuePage', () => {
|
|
beforeEach(() => {
|
|
useWorkflowStore.setState({ projectPath: '/test/path' });
|
|
vi.clearAllMocks();
|
|
});
|
|
|
|
describe('with en locale', () => {
|
|
it('should render page title', () => {
|
|
render(<QueuePage />, { locale: 'en' });
|
|
expect(screen.getByText(/Issue Queue/i)).toBeInTheDocument();
|
|
});
|
|
|
|
it('should render page description', () => {
|
|
render(<QueuePage />, { locale: 'en' });
|
|
expect(screen.getByText(/Manage issue execution queue/i)).toBeInTheDocument();
|
|
});
|
|
|
|
it('should render stats cards', () => {
|
|
render(<QueuePage />, { locale: 'en' });
|
|
expect(screen.getAllByText(/Total Items/i).length).toBeGreaterThan(0);
|
|
expect(screen.getAllByText(/Groups/i).length).toBeGreaterThan(0);
|
|
expect(screen.getAllByText(/Tasks/i).length).toBeGreaterThan(0);
|
|
expect(screen.getAllByText(/Solutions/i).length).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('should render refresh button', () => {
|
|
render(<QueuePage />, { locale: 'en' });
|
|
const refreshButton = screen.getByRole('button', { name: /refresh/i });
|
|
expect(refreshButton).toBeInTheDocument();
|
|
});
|
|
});
|
|
|
|
describe('with zh locale', () => {
|
|
it('should render translated title', () => {
|
|
render(<QueuePage />, { locale: 'zh' });
|
|
expect(screen.getByText(/问题队列/i)).toBeInTheDocument();
|
|
});
|
|
|
|
it('should render translated description', () => {
|
|
render(<QueuePage />, { locale: 'zh' });
|
|
expect(screen.getByText(/管理问题执行队列/i)).toBeInTheDocument();
|
|
});
|
|
|
|
it('should render translated stats', () => {
|
|
render(<QueuePage />, { locale: 'zh' });
|
|
expect(screen.getAllByText(/总项目/i).length).toBeGreaterThan(0);
|
|
expect(screen.getAllByText(/执行组/i).length).toBeGreaterThan(0);
|
|
expect(screen.getAllByText(/任务/i).length).toBeGreaterThan(0);
|
|
expect(screen.getAllByText(/解决方案/i).length).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('should render translated refresh button', () => {
|
|
render(<QueuePage />, { locale: 'zh' });
|
|
const refreshButton = screen.getByRole('button', { name: /刷新/i });
|
|
expect(refreshButton).toBeInTheDocument();
|
|
});
|
|
});
|
|
|
|
describe('conflicts warning', () => {
|
|
it('should show conflicts warning when conflicts exist', () => {
|
|
// This test would require modifying the mock data
|
|
// For now, we just verify the page renders without crashing
|
|
render(<QueuePage />, { locale: 'en' });
|
|
const page = screen.getByText(/Issue Queue/i);
|
|
expect(page).toBeInTheDocument();
|
|
});
|
|
});
|
|
|
|
describe('accessibility', () => {
|
|
it('should have proper heading structure', () => {
|
|
render(<QueuePage />, { locale: 'en' });
|
|
const heading = screen.getByRole('heading', { level: 1, name: /Issue Queue/i });
|
|
expect(heading).toBeInTheDocument();
|
|
});
|
|
|
|
it('should have accessible refresh button', () => {
|
|
render(<QueuePage />, { locale: 'en' });
|
|
const refreshButton = screen.getByRole('button', { name: /refresh/i });
|
|
expect(refreshButton).toBeInTheDocument();
|
|
});
|
|
});
|
|
});
|