import { render, screen } from '@testing-library/react';
import { ProjectStatusBadge, AutonomyBadge } from '@/components/projects/StatusBadge';
describe('ProjectStatusBadge', () => {
it('renders active status correctly', () => {
render();
expect(screen.getByText('Active')).toBeInTheDocument();
});
it('renders completed status correctly', () => {
render();
expect(screen.getByText('Completed')).toBeInTheDocument();
});
it('renders paused status correctly', () => {
render();
expect(screen.getByText('Paused')).toBeInTheDocument();
});
it('renders archived status correctly', () => {
render();
expect(screen.getByText('Archived')).toBeInTheDocument();
});
it('applies custom className', () => {
const { container } = render(
);
expect(container.firstChild).toHaveClass('custom-class');
});
});
describe('AutonomyBadge', () => {
it('renders full_control level correctly', () => {
render();
expect(screen.getByText('Full Control')).toBeInTheDocument();
});
it('renders milestone level correctly', () => {
render();
expect(screen.getByText('Milestone')).toBeInTheDocument();
});
it('renders autonomous level correctly', () => {
render();
expect(screen.getByText('Autonomous')).toBeInTheDocument();
});
it('has title attribute with description', () => {
render();
// The Badge component is the closest ancestor with the title
const badge = screen.getByText('Milestone').closest('[title]');
expect(badge).toHaveAttribute('title', 'Approve at sprint boundaries');
});
it('applies custom className', () => {
const { container } = render(
);
expect(container.firstChild).toHaveClass('custom-class');
});
});