test(app): former PDF, observation card, route and schema assertions restored on v3; foreign JSON attachment reported as no_attachment; doc counts

This commit is contained in:
bchanot committed 2026-10-10 12:21:19 +02:00
1 parent 06a2e86f3c
commit 17a6d9b323
9 files changed
+406 -27

No files matched your search

@@ -153,3 +153,27 @@ describe('sessionStorage mirror and restore', () => {
expect(saved.at(-1)).toMatchObject({ version: 3 })
})
})
describe('store edge cases', () => {
it('hydrateReport stores the given object as is, without revalidating', () => {
const odd = { ...minimalReport(sheet), extra: 1 }
useReportStore.getState().hydrateReport(odd)
expect(useReportStore.getState().report).toBe(odd)
expect(
(useReportStore.getState().report as unknown as { extra: number }).extra,
).toBe(1)
})
it('identity setters are no-ops without a report', () => {
const s = useReportStore.getState()
s.setPractitioner({ name: 'X' })
s.setAnimal({ speciesId: 'equine', name: 'X' })
s.setOwner({ name: 'X' })
expect(useReportStore.getState().report).toBeNull()
})
it('restoreDraft with no draft leaves the store empty', () => {
useReportStore.getState().restoreDraft(sheet.sheet.migrationMap)
expect(useReportStore.getState().report).toBeNull()
})
})