StatusBadge and SimulationStatusBadge now call engagementStatusLabel() / simulationStatusLabel() from @/i18n/status.ts instead of hardcoded English strings. Tests updated to expect French labels (Planifié/Actif/Clôturé, En attente/En cours/Révision requise/Terminé). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { render, screen } from '@testing-library/react';
|
|
import { StatusBadge } from '@/components/StatusBadge';
|
|
|
|
const LABELS: Record<string, string> = {
|
|
planned: 'Planifié',
|
|
active: 'Actif',
|
|
closed: 'Clôturé',
|
|
};
|
|
|
|
describe('StatusBadge', () => {
|
|
it.each(['planned', 'active', 'closed'] as const)('renders %s label and data attr', (status) => {
|
|
render(<StatusBadge status={status} />);
|
|
const badge = screen.getByTestId('status-badge');
|
|
expect(badge).toHaveAttribute('data-status', status);
|
|
expect(badge.textContent).toBe(LABELS[status]);
|
|
});
|
|
|
|
it('applies warn-soft surface for planned', () => {
|
|
render(<StatusBadge status="planned" />);
|
|
expect(screen.getByTestId('status-badge').className).toContain('bg-warn-soft');
|
|
});
|
|
|
|
it('applies primary-soft surface for active', () => {
|
|
render(<StatusBadge status="active" />);
|
|
expect(screen.getByTestId('status-badge').className).toContain('bg-primary-soft');
|
|
});
|
|
|
|
it('applies cloud surface for closed', () => {
|
|
render(<StatusBadge status="closed" />);
|
|
expect(screen.getByTestId('status-badge').className).toContain('bg-cloud');
|
|
});
|
|
});
|