test(frontend): update tests for type changes

Update all test files to use correct enum values:
- AgentPanel, AgentStatusIndicator tests
- ProjectHeader, StatusBadge tests
- IssueSummary, IssueTable tests
- StatusBadge, StatusWorkflow tests (issues)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-31 12:48:11 +01:00
parent 35af7daf90
commit f0b04d53af
8 changed files with 32 additions and 48 deletions

View File

@@ -10,7 +10,7 @@ const mockAgents: AgentInstance[] = [
project_id: 'proj-001',
name: 'Product Owner',
role: 'product_owner',
status: 'active',
status: 'working',
current_task: 'Reviewing user stories',
last_activity_at: new Date().toISOString(),
spawned_at: '2025-01-15T00:00:00Z',

View File

@@ -8,12 +8,6 @@ describe('AgentStatusIndicator', () => {
expect(indicator).toHaveClass('bg-yellow-500');
});
it('renders active status with correct color', () => {
const { container } = render(<AgentStatusIndicator status="active" />);
const indicator = container.querySelector('span > span');
expect(indicator).toHaveClass('bg-green-500');
});
it('renders working status with animation', () => {
const { container } = render(<AgentStatusIndicator status="working" />);
const indicator = container.querySelector('span > span');
@@ -21,16 +15,16 @@ describe('AgentStatusIndicator', () => {
expect(indicator).toHaveClass('animate-pulse');
});
it('renders pending status with correct color', () => {
const { container } = render(<AgentStatusIndicator status="pending" />);
it('renders waiting status with correct color', () => {
const { container } = render(<AgentStatusIndicator status="waiting" />);
const indicator = container.querySelector('span > span');
expect(indicator).toHaveClass('bg-gray-400');
expect(indicator).toHaveClass('bg-blue-500');
});
it('renders error status with correct color', () => {
const { container } = render(<AgentStatusIndicator status="error" />);
it('renders paused status with correct color', () => {
const { container } = render(<AgentStatusIndicator status="paused" />);
const indicator = container.querySelector('span > span');
expect(indicator).toHaveClass('bg-red-500');
expect(indicator).toHaveClass('bg-gray-400');
});
it('renders terminated status with correct color', () => {
@@ -40,41 +34,41 @@ describe('AgentStatusIndicator', () => {
});
it('applies small size by default', () => {
const { container } = render(<AgentStatusIndicator status="active" />);
const { container } = render(<AgentStatusIndicator status="working" />);
const indicator = container.querySelector('span > span');
expect(indicator).toHaveClass('h-2', 'w-2');
});
it('applies medium size when specified', () => {
const { container } = render(<AgentStatusIndicator status="active" size="md" />);
const { container } = render(<AgentStatusIndicator status="working" size="md" />);
const indicator = container.querySelector('span > span');
expect(indicator).toHaveClass('h-3', 'w-3');
});
it('applies large size when specified', () => {
const { container } = render(<AgentStatusIndicator status="active" size="lg" />);
const { container } = render(<AgentStatusIndicator status="working" size="lg" />);
const indicator = container.querySelector('span > span');
expect(indicator).toHaveClass('h-4', 'w-4');
});
it('shows label when showLabel is true', () => {
render(<AgentStatusIndicator status="active" showLabel />);
expect(screen.getByText('Active')).toBeInTheDocument();
render(<AgentStatusIndicator status="working" showLabel />);
expect(screen.getByText('Working')).toBeInTheDocument();
});
it('does not show label by default', () => {
render(<AgentStatusIndicator status="active" />);
expect(screen.queryByText('Active')).not.toBeInTheDocument();
render(<AgentStatusIndicator status="working" />);
expect(screen.queryByText('Working')).not.toBeInTheDocument();
});
it('has accessible status role and label', () => {
render(<AgentStatusIndicator status="active" />);
expect(screen.getByRole('status')).toHaveAttribute('aria-label', 'Status: Active');
render(<AgentStatusIndicator status="working" />);
expect(screen.getByRole('status')).toHaveAttribute('aria-label', 'Status: Working');
});
it('applies custom className', () => {
const { container } = render(
<AgentStatusIndicator status="active" className="custom-class" />
<AgentStatusIndicator status="working" className="custom-class" />
);
expect(container.firstChild).toHaveClass('custom-class');
});

View File

@@ -1,14 +1,14 @@
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { IssueSummary } from '@/components/projects/IssueSummary';
import type { IssueSummary as IssueSummaryType } from '@/components/projects/types';
import type { IssueCountSummary } from '@/components/projects/types';
const mockSummary: IssueSummaryType = {
const mockSummary: IssueCountSummary = {
open: 12,
in_progress: 8,
in_review: 3,
blocked: 2,
done: 45,
closed: 45,
total: 70,
};
@@ -33,7 +33,7 @@ describe('IssueSummary', () => {
expect(screen.getByText('Blocked')).toBeInTheDocument();
expect(screen.getByText('2')).toBeInTheDocument();
expect(screen.getByText('Completed')).toBeInTheDocument();
expect(screen.getByText('Closed')).toBeInTheDocument();
expect(screen.getByText('45')).toBeInTheDocument();
});

View File

@@ -7,7 +7,7 @@ const mockProject: Project = {
id: 'proj-001',
name: 'Test Project',
description: 'A test project for unit testing',
status: 'in_progress',
status: 'active',
autonomy_level: 'milestone',
created_at: '2025-01-15T00:00:00Z',
owner_id: 'user-001',
@@ -26,7 +26,7 @@ describe('ProjectHeader', () => {
it('renders project status badge', () => {
render(<ProjectHeader project={mockProject} />);
expect(screen.getByText('In Progress')).toBeInTheDocument();
expect(screen.getByText('Active')).toBeInTheDocument();
});
it('renders autonomy level badge', () => {
@@ -44,7 +44,7 @@ describe('ProjectHeader', () => {
expect(container.querySelectorAll('.animate-pulse').length).toBeGreaterThan(0);
});
it('shows pause button when canPause is true and project is in_progress', () => {
it('shows pause button when canPause is true and project is active', () => {
const onPauseProject = jest.fn();
render(
<ProjectHeader
@@ -56,7 +56,7 @@ describe('ProjectHeader', () => {
expect(screen.getByRole('button', { name: /pause project/i })).toBeInTheDocument();
});
it('does not show pause button when project is not in_progress', () => {
it('does not show pause button when project is not active', () => {
const completedProject = { ...mockProject, status: 'completed' as const };
render(<ProjectHeader project={completedProject} canPause={true} />);
expect(screen.queryByRole('button', { name: /pause project/i })).not.toBeInTheDocument();

View File

@@ -2,9 +2,9 @@ import { render, screen } from '@testing-library/react';
import { ProjectStatusBadge, AutonomyBadge } from '@/components/projects/StatusBadge';
describe('ProjectStatusBadge', () => {
it('renders in_progress status correctly', () => {
render(<ProjectStatusBadge status="in_progress" />);
expect(screen.getByText('In Progress')).toBeInTheDocument();
it('renders active status correctly', () => {
render(<ProjectStatusBadge status="active" />);
expect(screen.getByText('Active')).toBeInTheDocument();
});
it('renders completed status correctly', () => {
@@ -12,21 +12,11 @@ describe('ProjectStatusBadge', () => {
expect(screen.getByText('Completed')).toBeInTheDocument();
});
it('renders blocked status correctly', () => {
render(<ProjectStatusBadge status="blocked" />);
expect(screen.getByText('Blocked')).toBeInTheDocument();
});
it('renders paused status correctly', () => {
render(<ProjectStatusBadge status="paused" />);
expect(screen.getByText('Paused')).toBeInTheDocument();
});
it('renders draft status correctly', () => {
render(<ProjectStatusBadge status="draft" />);
expect(screen.getByText('Draft')).toBeInTheDocument();
});
it('renders archived status correctly', () => {
render(<ProjectStatusBadge status="archived" />);
expect(screen.getByText('Archived')).toBeInTheDocument();
@@ -34,7 +24,7 @@ describe('ProjectStatusBadge', () => {
it('applies custom className', () => {
const { container } = render(
<ProjectStatusBadge status="in_progress" className="custom-class" />
<ProjectStatusBadge status="active" className="custom-class" />
);
expect(container.firstChild).toHaveClass('custom-class');
});

View File

@@ -11,6 +11,7 @@ const mockIssues: IssueSummary[] = [
{
id: 'issue-1',
number: 42,
type: 'bug',
title: 'Test Issue 1',
description: 'Description 1',
status: 'open',
@@ -25,6 +26,7 @@ const mockIssues: IssueSummary[] = [
{
id: 'issue-2',
number: 43,
type: 'story',
title: 'Test Issue 2',
description: 'Description 2',
status: 'in_progress',

View File

@@ -11,12 +11,11 @@ const statusLabels: Record<IssueStatus, string> = {
in_progress: 'In Progress',
in_review: 'In Review',
blocked: 'Blocked',
done: 'Done',
closed: 'Closed',
};
describe('StatusBadge', () => {
const statuses: IssueStatus[] = ['open', 'in_progress', 'in_review', 'blocked', 'done', 'closed'];
const statuses: IssueStatus[] = ['open', 'in_progress', 'in_review', 'blocked', 'closed'];
it.each(statuses)('renders %s status correctly', (status) => {
render(<StatusBadge status={status} />);

View File

@@ -22,7 +22,6 @@ describe('StatusWorkflow', () => {
expect(screen.getByText('In Progress')).toBeInTheDocument();
expect(screen.getByText('In Review')).toBeInTheDocument();
expect(screen.getByText('Blocked')).toBeInTheDocument();
expect(screen.getByText('Done')).toBeInTheDocument();
expect(screen.getByText('Closed')).toBeInTheDocument();
});