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.
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { ReportSchema } from '@/domain/schema/report'
|
|
|
|
const minimal = {
|
|
version: 2 as const,
|
|
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: '',
|
|
recommendations: '',
|
|
}
|
|
|
|
describe('ReportSchema', () => {
|
|
it('accepts a minimal valid report', () => {
|
|
expect(() => ReportSchema.parse(minimal)).not.toThrow()
|
|
})
|
|
|
|
it('accepts nextAppointment kind=date', () => {
|
|
expect(() =>
|
|
ReportSchema.parse({
|
|
...minimal,
|
|
nextAppointment: { kind: 'date', date: '2026-06-08' },
|
|
}),
|
|
).not.toThrow()
|
|
})
|
|
|
|
it('accepts nextAppointment kind=period', () => {
|
|
expect(() =>
|
|
ReportSchema.parse({
|
|
...minimal,
|
|
nextAppointment: { kind: 'period', text: 'dans 3 semaines' },
|
|
}),
|
|
).not.toThrow()
|
|
})
|
|
|
|
it('rejects legacy v1 reports', () => {
|
|
expect(() => ReportSchema.parse({ ...minimal, version: 1 })).toThrow()
|
|
})
|
|
|
|
it('rejects unknown future versions', () => {
|
|
expect(() => ReportSchema.parse({ ...minimal, version: 3 })).toThrow()
|
|
})
|
|
|
|
it('rejects empty practitioner.name', () => {
|
|
expect(() =>
|
|
ReportSchema.parse({ ...minimal, practitioner: { name: '' } }),
|
|
).toThrow()
|
|
})
|
|
})
|