Skip to content

Commit 37d7925

Browse files
committed
fix: give Processed status its own label key and add missing tests
1 parent d325611 commit 37d7925

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

src/SEBT.Portal.Web/src/features/household/components/CardStatusDisplay/CardStatusDisplay.test.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,34 @@ describe('CardStatusDisplay', () => {
9696
expect(screen.getByTestId('card-status-badge')).toHaveTextContent('Inactive')
9797
})
9898

99+
it('renders Processed status badge with info styling', () => {
100+
renderWithStatus('Processed')
101+
102+
const badge = screen.getByTestId('card-status-badge')
103+
// i18n key: cardTableStatusProcessed
104+
expect(badge).toHaveTextContent(/processed/i)
105+
expect(badge.className).toContain('bg-info-dark')
106+
})
107+
108+
it('renders Inactive badge for Deactivated status', () => {
109+
renderWithStatus('Deactivated')
110+
111+
expect(screen.getByTestId('card-status-badge')).toHaveTextContent('Inactive')
112+
})
113+
114+
it('shows deactivated description for Deactivated status', () => {
115+
renderWithStatus('Deactivated')
116+
117+
// i18n key: cardTableStatusMessageDeactivated
118+
expect(screen.getByText(/reported as lost, stolen, damaged/)).toBeInTheDocument()
119+
})
120+
121+
it('does not show replacement card link for Processed status', () => {
122+
renderWithStatus('Processed')
123+
124+
expect(screen.queryByRole('link')).toBeNull()
125+
})
126+
99127
it('renders Frozen status badge', () => {
100128
renderWithStatus('Frozen')
101129

src/SEBT.Portal.Web/src/features/household/components/CardStatusDisplay/CardStatusDisplay.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface CardStatusDisplayProps {
1313
// Keys map to CSV: "S2 - Portal Dashboard - Card Table - Status {Status}"
1414
const STATUS_CONFIG: Record<UiCardStatus, { colorClass: string; labelKey: string }> = {
1515
Active: { colorClass: 'bg-success-dark text-white', labelKey: 'cardTableStatusActive' },
16-
Processed: { colorClass: 'bg-info-dark text-white', labelKey: 'cardTableStatusInactive' },
16+
Processed: { colorClass: 'bg-info-dark text-white', labelKey: 'cardTableStatusProcessed' },
1717
Inactive: { colorClass: 'bg-error-dark text-white', labelKey: 'cardTableStatusInactive' },
1818
Frozen: { colorClass: 'bg-warning-dark text-white', labelKey: 'cardTableStatusFrozen' },
1919
Undeliverable: {
@@ -24,6 +24,7 @@ const STATUS_CONFIG: Record<UiCardStatus, { colorClass: string; labelKey: string
2424

2525
const DESCRIPTION_KEY: Partial<Record<CardStatus, string>> = {
2626
Active: 'cardTableStatusMessageActive',
27+
Processed: 'cardTableStatusMessageProcessed',
2728
Lost: 'cardTableStatusMessageInactive',
2829
Stolen: 'cardTableStatusMessageInactive',
2930
Damaged: 'cardTableStatusMessageInactive',

0 commit comments

Comments
 (0)