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.
56 lines
1.6 KiB
TypeScript
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: 2 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')
|
|
})
|
|
})
|