Files
faunosteo/apps/app/tests/helpers/sheet.ts
T

40 lines
1.1 KiB
TypeScript

import {
REPORT_VERSION,
type Observation,
type Report,
} from '@faunosteo/domain'
import { loadSheetIndex } from '@/sheets/useSheet'
import type { SheetIndex } from '@/services/sheetIndex'
/** The bundled reference draft (vitest runs the sheet-bundle plugin in draft mode). */
export async function loadTestSheet(): Promise<SheetIndex> {
const index = await loadSheetIndex('equine')
if (!index) throw new Error('bundled sheet missing: run pnpm import:equine')
return index
}
export function emptyObservation(id = 'obs-1'): Observation {
return { id, zones: [], findings: [], freeTextFindings: [], comment: '' }
}
export function minimalReport(
sheet: SheetIndex,
patch: Partial<Report> = {},
): Report {
return {
version: REPORT_VERSION,
id: 'r1',
createdAt: '2026-10-10T10:00:00Z',
date: '2026-10-10',
practitioner: { name: 'Dr. Dupont' },
animal: { speciesId: 'equine', name: 'Mistral' },
owner: { name: 'Jean Martin' },
sheet: sheet.sheet.ref,
observations: [],
conclusion: '',
recommendations: '',
localAnnotations: [],
...patch,
}
}