+
+ setSearch(e.target.value)}
+ />
+
+
+
+
+ {filtered.length === 0 ? (
+
No incidents found
+ ) : (
+
+ {filtered.map(inc => (
+
+
+
+
+ {inc.reference_no ?? 'β'}
+
+
+ {inc.status.replace(/_/g, ' ').toUpperCase()}
+
+
+
+ {TYPE_LABELS[inc.incident_type] ?? inc.incident_type}
+ {inc.zones?.name && ` Β· ${inc.zones.name}`}
+ {inc.sites?.name && ` Β· ${inc.sites.name}`}
+
+
+
+
+ {new Date(inc.reported_at).toLocaleDateString('en-MY')}
+
+ {inc.severity && (
+
Sev {inc.severity}
+ )}
+
+
+ ))}
+
+ )}
+
+ )
+}
diff --git a/tests/components/incidents/incident-list.test.tsx b/tests/components/incidents/incident-list.test.tsx
new file mode 100644
index 0000000..8979a00
--- /dev/null
+++ b/tests/components/incidents/incident-list.test.tsx
@@ -0,0 +1,53 @@
+import { describe, it, expect } from 'vitest'
+import { render, screen } from '@testing-library/react'
+import { IncidentList } from '@/components/incidents/incident-list'
+
+const mockIncidents = [
+ {
+ id: 'inc-001',
+ reference_no: 'SCW1-202607-0001',
+ incident_type: 'near_miss',
+ status: 'reported',
+ severity: null,
+ reported_at: '2026-07-10T09:00:00Z',
+ sites: { name: 'SCW1' },
+ zones: { name: 'Dock A' },
+ reporter: { name: 'John Doe' },
+ },
+ {
+ id: 'inc-002',
+ reference_no: 'SCW1-202607-0002',
+ incident_type: 'injury',
+ status: 'triaged',
+ severity: 3,
+ reported_at: '2026-07-10T10:00:00Z',
+ sites: { name: 'SCW1' },
+ zones: { name: 'Loading Bay' },
+ reporter: { name: 'Jane Smith' },
+ },
+]
+
+describe('IncidentList', () => {
+ it('renders all incident rows', () => {
+ render(