Files
faunosteo/apps/app/tests/unit/species.equineFindings.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

53 lines
1.6 KiB
TypeScript

import { describe, it, expect } from 'vitest'
import EQUINE_FINDINGS from '@/domain/species/equine/pathologies'
import {
SpeciesFindingsSchema,
type FindingNode,
} from '@/domain/schema/findings'
function walkLeaves(node: FindingNode, fn: (leaf: FindingNode) => void): void {
if (!node.children || node.children.length === 0) {
fn(node)
return
}
for (const child of node.children) walkLeaves(child, fn)
}
describe('equine findings tree', () => {
it('parses against SpeciesFindingsSchema', () => {
expect(() => SpeciesFindingsSchema.parse(EQUINE_FINDINGS)).not.toThrow()
})
it('species id matches the registry id', () => {
expect(EQUINE_FINDINGS.species.id).toBe('equine')
})
it('scope_disclaimer is non-empty', () => {
expect(EQUINE_FINDINGS.scope_disclaimer.length).toBeGreaterThan(0)
})
it('has at least one zone with at least one category with at least one leaf', () => {
const zoneIds = Object.keys(EQUINE_FINDINGS.zones)
expect(zoneIds.length).toBeGreaterThanOrEqual(1)
const someZone = EQUINE_FINDINGS.zones[zoneIds[0]]
expect(someZone.categories.length).toBeGreaterThanOrEqual(1)
let leafCount = 0
walkLeaves(someZone.categories[0], () => {
leafCount += 1
})
expect(leafCount).toBeGreaterThanOrEqual(1)
})
it('every leaf carries both FR and EN labels', () => {
const missing: string[] = []
for (const zone of Object.values(EQUINE_FINDINGS.zones)) {
for (const category of zone.categories) {
walkLeaves(category, (leaf) => {
if (!leaf.name_fr || !leaf.name_en) missing.push(leaf.id)
})
}
}
expect(missing).toEqual([])
})
})