import { describe, it, expect } from 'vitest' import { ReportSchema } from '@faunosteo/core-wasm/n-1' 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', () => { expect(todayIso()).toMatch(/^\d{4}-\d{2}-\d{2}$/) }) it('nowIso returns an ISO timestamp string', () => { expect(nowIso()).toMatch(/^\d{4}-\d{2}-\d{2}T/) }) it('the N-1 ReportSchema parses a valid minimal v3 report', () => { const result = ReportSchema.safeParse({ version: 3, id: generateId(), createdAt: nowIso(), date: todayIso(), practitioner: { name: 'Dr. Dupont' }, animal: { speciesId: 'equine', name: 'Mistral' }, owner: { name: 'Jean Martin' }, sheet: { sheetId: 's', versionId: null, documentSha256: 'a'.repeat(64) }, observations: [], conclusion: '', recommendations: '', }) expect(result.success).toBe(true) }) it('the N-1 ReportSchema rejects a report missing required fields', () => { expect(ReportSchema.safeParse({ version: 1, id: '' }).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') }) })