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.
73 lines
2.1 KiB
TypeScript
73 lines
2.1 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { readFileSync } from 'node:fs'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { dirname, resolve } from 'node:path'
|
|
|
|
import { parseSvgBones } from '@/anatomy/svgConvention'
|
|
|
|
const HERE = dirname(fileURLToPath(import.meta.url))
|
|
const HORSE_PATH = resolve(HERE, '../../public/species/equine/Horse.svg')
|
|
const HEAD_PATH = resolve(HERE, '../../public/species/equine/Horse_head.svg')
|
|
|
|
function loadSvg(path: string): SVGSVGElement {
|
|
const raw = readFileSync(path, 'utf8')
|
|
const doc = new DOMParser().parseFromString(raw, 'image/svg+xml')
|
|
return doc.documentElement as unknown as SVGSVGElement
|
|
}
|
|
|
|
describe('real Horse.svg', () => {
|
|
const map = parseSvgBones(loadSvg(HORSE_PATH))
|
|
|
|
it('parses 18 unique annotations', () => {
|
|
expect(map.size).toBe(18)
|
|
})
|
|
|
|
it('contains 5 zone-colonne annotations (cervical / thoracic / lumbar / sacral / caudal)', () => {
|
|
const spine = [...map.values()].filter(
|
|
(b) => b.category === 'zone-colonne',
|
|
)
|
|
expect(spine.length).toBe(5)
|
|
})
|
|
|
|
it('contains exactly one opens-detail trigger pointing at the head SVG', () => {
|
|
const triggers = [...map.values()].filter((b) => b.opensDetail === 'head')
|
|
expect(triggers.length).toBe(1)
|
|
})
|
|
|
|
it('contains 9 articulations', () => {
|
|
const arts = [...map.values()].filter(
|
|
(b) => b.category === 'articulations',
|
|
)
|
|
expect(arts.length).toBe(9)
|
|
})
|
|
|
|
it('contains 3 vertebral hinges', () => {
|
|
const ch = [...map.values()].filter(
|
|
(b) => b.category === 'charni-res-vert-brales',
|
|
)
|
|
expect(ch.length).toBe(3)
|
|
})
|
|
})
|
|
|
|
describe('real Horse_head.svg', () => {
|
|
const map = parseSvgBones(loadSvg(HEAD_PATH))
|
|
|
|
it('parses 9 unique annotations', () => {
|
|
expect(map.size).toBe(9)
|
|
})
|
|
|
|
it('contains 5 cadrans-du-cr-ne annotations', () => {
|
|
const cadrans = [...map.values()].filter(
|
|
(b) => b.category === 'cadrans-du-cr-ne',
|
|
)
|
|
expect(cadrans.length).toBe(5)
|
|
})
|
|
|
|
it('contains 2 articulations (ATM + SSB equivalents)', () => {
|
|
const arts = [...map.values()].filter(
|
|
(b) => b.category === 'articulations',
|
|
)
|
|
expect(arts.length).toBe(2)
|
|
})
|
|
})
|