docs(docs): add anatomical audit of existing SVG, catalog and report systems
Read-only technical audit before the SaaS redesign: 13 reports, a logical anatomical-sheet JSON built from real horse data, verbatim copies of the 52 relevant source files, and a self-contained ZIP.
This commit is contained in:
1 parent
83e40af99b
commit
e471d41c6b
70 files changed
+22075
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { PDFDocument } from 'pdf-lib'
|
||||
import { attachReportJson, extractReportJson } from '@/pdf/attachment'
|
||||
import type { Report } from '@/domain/schema/report'
|
||||
|
||||
const report: Report = {
|
||||
version: 2,
|
||||
id: 'r1',
|
||||
createdAt: '2026-05-18T10:00:00Z',
|
||||
date: '2026-05-18',
|
||||
practitioner: { name: 'Dr. Dupont' },
|
||||
animal: { speciesId: 'equine', name: 'Mistral' },
|
||||
owner: { name: 'Jean Martin' },
|
||||
observations: [],
|
||||
conclusion: 'tout va bien',
|
||||
recommendations: 'continuer',
|
||||
}
|
||||
|
||||
describe('PDF attachment roundtrip', () => {
|
||||
it('attaches and extracts the report JSON', async () => {
|
||||
const doc = await PDFDocument.create()
|
||||
doc.addPage()
|
||||
await attachReportJson(doc, report)
|
||||
const bytes = await doc.save()
|
||||
|
||||
const reopened = await PDFDocument.load(bytes)
|
||||
const out = await extractReportJson(reopened)
|
||||
expect(out.conclusion).toBe('tout va bien')
|
||||
expect(out.animal.name).toBe('Mistral')
|
||||
expect(out.version).toBe(2)
|
||||
})
|
||||
|
||||
it('throws on PDFs without the attachment', async () => {
|
||||
const doc = await PDFDocument.create()
|
||||
doc.addPage()
|
||||
const bytes = await doc.save()
|
||||
const reopened = await PDFDocument.load(bytes)
|
||||
await expect(extractReportJson(reopened)).rejects.toThrow()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user