fix(app): editor route split into dialogs and pickers components, canvas without lint suppression, findings picker coverage restored; golden test pins every generated draft file; stale doc lines

This commit is contained in:
bchanot committed 2026-10-10 11:55:57 +02:00
1 parent 0476276a8f
commit 09d8b01a54
11 files changed
+374 -161

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ the Report v2 document as the current application produces it.
| File | Content |
|---|---|
| `report-v2.full.json` | One report exercising every zone kind the editor can produce: plain hinge point, bilateral joint with both sides, spine zone with vertebrae, detail-popup zone, catalog findings (with and without vet referral and side), free text, severity, comment, conclusion, recommendations, dated next appointment. `boneId` values are the real `data-anno-id` of `public/species/equine/*.svg`; `zoneId`/`path` values exist in `pathologies.json`. |
| `report-v2.full.json` | One report exercising every zone kind the editor can produce: plain hinge point, bilateral joint with both sides, spine zone with vertebrae, detail-popup zone, catalog findings (with and without vet referral and side), free text, severity, comment, conclusion, recommendations, dated next appointment. `boneId` values are the real `data-anno-id` of the legacy `Horse.svg` / `Horse_head.svg` now kept under `supabase/seed/anatomical-sheets/equine/legacy-sources/`; `zoneId`/`path` values exist in `pathologies.json`. |
| `report-v2.minimal.json` | Smallest valid v2 report (no observations). |
| `report-v2.full.pdf`, `report-v2.minimal.pdf` | The two reports exported by the v2 pipeline (commit 199e328, Step 5.0, rasteriser stubbed to a 1×1 PNG, no logos): the archive-like PDFs the v3 importer must read and migrate. Synthetic data only. |
@@ -109,4 +109,116 @@ describe('FindingsTreePicker on a sheet finding zone', () => {
}),
).toBeInTheDocument()
})
it('flags a vet-referral leaf and omits the key on other leaves', async () => {
const user = userEvent.setup()
const onChange = vi.fn()
render(
<FindingsTreePicker
zone={sheet.findingZone('hip')!}
selected={[]}
onChange={onChange}
/>,
)
await user.click(
screen.getByRole('button', {
name: 'Ouvrir Dysfonctions ostéopathiques',
}),
)
await user.click(
screen.getByRole('button', {
name: 'Ouvrir Restrictions de mobilité articulaire',
}),
)
await user.click(
screen.getByRole('checkbox', { name: 'Hypermobilité / laxité perçue' }),
)
expect(onChange.mock.calls[0]![0][0].requiresVetReferral).toBe(true)
onChange.mockClear()
await user.click(
screen.getByRole('checkbox', { name: 'Hypomobilité globale' }),
)
expect(onChange.mock.calls[0]![0][0]).not.toHaveProperty(
'requiresVetReferral',
)
})
describe('count badges and scoping', () => {
const finding = (
path: string[],
extra: Partial<Finding> = {},
): Finding => ({
findingZoneId: 'hip',
path,
labelFrSnapshot: 'x',
labelEnSnapshot: 'x',
side: 'left',
...extra,
})
const base = [
finding(['hip-dysfunctions', 'articular', 'hypomobility']),
finding(['hip-dysfunctions', 'articular', 'hypermobility']),
finding(['hip-dysfunctions', 'muscular', 'trigger-points']),
]
function renderPicker(selected: Finding[]) {
render(
<FindingsTreePicker
zone={sheet.findingZone('hip')!}
side="left"
selected={selected}
onChange={vi.fn()}
/>,
)
}
it('counts selected findings per level, none on a clean sibling', async () => {
const user = userEvent.setup()
renderPicker(base)
expect(
screen.getByLabelText('3 constats sélectionnés'),
).toBeInTheDocument()
expect(screen.getAllByLabelText(/constats? sélectionnés?$/)).toHaveLength(
1,
)
await user.click(
screen.getByRole('button', {
name: 'Ouvrir Dysfonctions ostéopathiques',
}),
)
expect(
screen.getByLabelText('2 constats sélectionnés'),
).toBeInTheDocument()
expect(screen.getByLabelText('1 constat sélectionné')).toBeInTheDocument()
expect(screen.getAllByLabelText(/constats? sélectionnés?$/)).toHaveLength(
2,
)
})
it('ignores findings of another zone or another side', async () => {
const user = userEvent.setup()
renderPicker([
finding(['hip-dysfunctions', 'articular', 'hypomobility'], {
findingZoneId: 'stifle',
}),
finding(['hip-dysfunctions', 'articular', 'hypomobility'], {
side: 'right',
}),
])
expect(screen.queryByLabelText(/sélectionnés?$/)).toBeNull()
await user.click(
screen.getByRole('button', {
name: 'Ouvrir Dysfonctions ostéopathiques',
}),
)
await user.click(
screen.getByRole('button', {
name: 'Ouvrir Restrictions de mobilité articulaire',
}),
)
expect(
screen.getByRole('checkbox', { name: 'Hypomobilité globale' }),
).not.toBeChecked()
})
})
})