Files
syndarix/frontend/tests/features/issues/components/PriorityBadge.test.tsx
Felipe Cardoso 5c35702caf test(frontend): comprehensive test coverage improvements and bug fixes
- Raise coverage thresholds to 90% statements/lines/functions, 85% branches
- Add comprehensive tests for ProjectDashboard, ProjectWizard, and all wizard steps
- Add tests for issue management: IssueDetailPanel, BulkActions, IssueFilters
- Expand IssueTable tests with keyboard navigation, dropdown menu, edge cases
- Add useIssues hook tests covering all mutations and optimistic updates
- Expand eventStore tests with selector hooks and additional scenarios
- Expand useProjectEvents tests with error recovery, ping events, edge cases
- Add PriorityBadge, StatusBadge, SyncStatusIndicator fallback branch tests
- Add constants.test.ts for comprehensive constant validation

Bug fixes:
- Fix false positive rollback test to properly verify onMutate context setup
- Replace deprecated substr() with substring() in mock helpers
- Fix type errors: ProjectComplexity, ClientMode enum values
- Fix unused imports and variables across test files
- Fix @ts-expect-error directives and method override signatures

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 19:53:41 +01:00

41 lines
1.3 KiB
TypeScript

/**
* PriorityBadge Component Tests
*/
import { render, screen } from '@testing-library/react';
import { PriorityBadge } from '@/features/issues/components/PriorityBadge';
import type { IssuePriority } from '@/features/issues/types';
describe('PriorityBadge', () => {
const priorities: IssuePriority[] = ['high', 'medium', 'low'];
it.each(priorities)('renders %s priority correctly', (priority) => {
render(<PriorityBadge priority={priority} />);
// The priority should be displayed as capitalized
const capitalizedPriority = priority.charAt(0).toUpperCase() + priority.slice(1);
expect(screen.getByText(capitalizedPriority)).toBeInTheDocument();
});
it('applies custom className', () => {
render(<PriorityBadge priority="high" className="custom-class" />);
const badge = screen.getByText('High');
expect(badge).toHaveClass('custom-class');
});
it('renders critical priority', () => {
render(<PriorityBadge priority="critical" />);
expect(screen.getByText('Critical')).toBeInTheDocument();
});
it('falls back to medium config for unknown priority', () => {
// @ts-expect-error - Testing unknown priority value
render(<PriorityBadge priority="unknown-priority" />);
// Should fall back to medium config
expect(screen.getByText('Medium')).toBeInTheDocument();
});
});