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() expect(screen.getByText('SCW1-202607-0001')).toBeTruthy() expect(screen.getByText('SCW1-202607-0002')).toBeTruthy() }) it('shows incident type labels', () => { render() expect(screen.getByText('Near Miss')).toBeTruthy() expect(screen.getByText('Injury / Medical')).toBeTruthy() }) it('shows status badges', () => { render() expect(screen.getByText('REPORTED')).toBeTruthy() expect(screen.getByText('TRIAGED')).toBeTruthy() }) it('renders empty state when no incidents', () => { render() expect(screen.getByText(/no incidents/i)).toBeTruthy() }) })