import { describe, it, expect, vi } from 'vitest' import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import PathologyPicker from '@/components/observation/PathologyPicker' import type { Pathology } from '@/domain/schema/pathology' const POOL: Pathology[] = [ { id: 'a', labelFr: 'Aïe', description: '', category: 'osseux', speciesIds: ['equine'], boneIds: ['epaule'], sources: [{ type: 'manual', citation: 'X' }], }, { id: 'b', labelFr: 'Aïe-aïe', description: '', category: 'osseux', speciesIds: ['equine'], boneIds: ['hanche'], sources: [{ type: 'manual', citation: 'X' }], }, ] describe('PathologyPicker', () => { it('shows only pathologies matching zones', () => { render( {}} />, ) expect(screen.getByLabelText('Aïe')).toBeInTheDocument() expect(screen.queryByLabelText('Aïe-aïe')).toBeNull() }) it('toggles selection', async () => { const onChange = vi.fn() render( , ) await userEvent.click(screen.getByLabelText('Aïe')) expect(onChange).toHaveBeenCalledWith(['a']) }) })