diff --git a/frontend/src/components/SimulationStatusBadge.tsx b/frontend/src/components/SimulationStatusBadge.tsx index 7665441..0438e18 100644 --- a/frontend/src/components/SimulationStatusBadge.tsx +++ b/frontend/src/components/SimulationStatusBadge.tsx @@ -1,11 +1,5 @@ import type { SimulationStatus } from '@/api/types'; - -const LABELS: Record = { - pending: 'Pending', - in_progress: 'In progress', - review_required: 'Review required', - done: 'Done', -}; +import { simulationStatusLabel } from '@/i18n/status'; const STYLES: Record = { pending: 'bg-cloud text-graphite border border-hairline', @@ -21,7 +15,7 @@ export function SimulationStatusBadge({ status }: { status: SimulationStatus }): data-testid="simulation-status-badge" data-status={status} > - {LABELS[status]} + {simulationStatusLabel(status)} ); } diff --git a/frontend/src/components/StatusBadge.tsx b/frontend/src/components/StatusBadge.tsx index 971f7ec..075105a 100644 --- a/frontend/src/components/StatusBadge.tsx +++ b/frontend/src/components/StatusBadge.tsx @@ -1,10 +1,5 @@ import type { EngagementStatus } from '@/api/types'; - -const LABELS: Record = { - planned: 'Planned', - active: 'Active', - closed: 'Closed', -}; +import { engagementStatusLabel } from '@/i18n/status'; const STYLES: Record = { planned: 'bg-warn-soft text-warn border border-warn', @@ -19,7 +14,7 @@ export function StatusBadge({ status }: { status: EngagementStatus }): JSX.Eleme data-testid="status-badge" data-status={status} > - {LABELS[status]} + {engagementStatusLabel(status)} ); } diff --git a/frontend/tests/SimulationStatusBadge.test.tsx b/frontend/tests/SimulationStatusBadge.test.tsx index 796d995..fa065de 100644 --- a/frontend/tests/SimulationStatusBadge.test.tsx +++ b/frontend/tests/SimulationStatusBadge.test.tsx @@ -4,10 +4,10 @@ import { SimulationStatusBadge } from '@/components/SimulationStatusBadge'; import type { SimulationStatus } from '@/api/types'; const CASES: { status: SimulationStatus; label: string }[] = [ - { status: 'pending', label: 'Pending' }, - { status: 'in_progress', label: 'In progress' }, - { status: 'review_required', label: 'Review required' }, - { status: 'done', label: 'Done' }, + { status: 'pending', label: 'En attente' }, + { status: 'in_progress', label: 'En cours' }, + { status: 'review_required', label: 'Révision requise' }, + { status: 'done', label: 'Terminé' }, ]; describe('SimulationStatusBadge', () => { diff --git a/frontend/tests/StatusBadge.test.tsx b/frontend/tests/StatusBadge.test.tsx index a9e6187..8ebea55 100644 --- a/frontend/tests/StatusBadge.test.tsx +++ b/frontend/tests/StatusBadge.test.tsx @@ -2,12 +2,18 @@ import { describe, expect, it } from 'vitest'; import { render, screen } from '@testing-library/react'; import { StatusBadge } from '@/components/StatusBadge'; +const LABELS: Record = { + planned: 'Planifié', + active: 'Actif', + closed: 'Clôturé', +}; + describe('StatusBadge', () => { it.each(['planned', 'active', 'closed'] as const)('renders %s label and data attr', (status) => { render(); const badge = screen.getByTestId('status-badge'); expect(badge).toHaveAttribute('data-status', status); - expect(badge.textContent?.toLowerCase()).toBe(status); + expect(badge.textContent).toBe(LABELS[status]); }); it('applies warn-soft surface for planned', () => {