Files
faunosteo/tests/unit/smoke.test.ts
T
Bastien ChanotandClaude Opus 4.7 8ca36b5ccd chore: initial scaffold + design spec + implementation plan
Skeleton for Osteo Report MVP. Build passes, 7 smoke tests green, real
Horse.svg + Horse_head.svg in public/species/equine/. Zod schemas are
the contract; store/anatomy/pdf modules are typed stubs throwing
"not implemented" awaiting implementation.

Spec: docs/superpowers/specs/2026-05-18-osteo-report-mvp-design.md
Plan: docs/superpowers/plans/2026-05-18-osteo-report-mvp.md (23 phases, ~70 TDD tasks)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 20:55:10 +02:00

56 lines
1.6 KiB
TypeScript

import { describe, it, expect } from 'vitest'
import { ReportSchema } from '@/domain/schema/report'
import { generateId } from '@/lib/id'
import { todayIso, nowIso } from '@/lib/dates'
import { assert } from '@/lib/assert'
describe('skeleton smoke test', () => {
it('generates a non-empty id', () => {
const id = generateId()
expect(typeof id).toBe('string')
expect(id.length).toBeGreaterThan(0)
})
it('todayIso returns an ISO date string', () => {
const today = todayIso()
expect(today).toMatch(/^\d{4}-\d{2}-\d{2}$/)
})
it('nowIso returns an ISO timestamp string', () => {
const now = nowIso()
expect(now).toMatch(/^\d{4}-\d{2}-\d{2}T/)
})
it('ReportSchema parses a valid minimal report', () => {
const validReport = {
version: 1 as const,
id: generateId(),
createdAt: nowIso(),
date: todayIso(),
practitioner: { name: 'Dr. Dupont' },
animal: { speciesId: 'equine', name: 'Mistral' },
owner: { name: 'Jean Martin' },
observations: [],
conclusion: '',
recommendations: '',
}
const result = ReportSchema.safeParse(validReport)
expect(result.success).toBe(true)
})
it('ReportSchema rejects a report missing required fields', () => {
const invalid = { version: 1, id: '' }
const result = ReportSchema.safeParse(invalid)
expect(result.success).toBe(false)
})
it('assert passes when condition is truthy', () => {
expect(() => assert(true, 'should not throw')).not.toThrow()
})
it('assert throws when condition is falsy', () => {
expect(() => assert(false, 'boom')).toThrow('Assertion failed: boom')
})
})