Files
faunosteo/apps/app/tests/unit/anatomy.horse.test.ts
T
bchanot 8673475293 chore(workspace): move the app to apps/app under a pnpm workspace (step 2)
144 files moved with git mv (pure renames). Root package.json delegates
dev/typecheck/test:run/lint/build to the packages; Node 24 LTS and
pnpm 10.13.1 pinned (.nvmrc, .node-version, engines, packageManager,
root devDependency, engine-strict). Dockerfile builds @faunosteo/app on
node:24-alpine and copies apps/app/dist; nginx and runtime config
unchanged. CI workflow for Gitea Actions. packages/ reserved (README only).
Docs synced: WORKSPACE.md, CLAUDE.md, README, DEPLOY, CHANGELOG, plan.
271/271 tests, typecheck, lint, build green from the root.
2026-10-08 21:51:13 +02:00

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)
})
})