40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { PathologySchema } from '@/domain/schema/pathology'
|
|
import EQUINE_PATHOLOGIES from '@/domain/species/equine/pathologies'
|
|
|
|
describe('equine pathologies database', () => {
|
|
it('has between 0 and 100 entries (empty allowed for v1)', () => {
|
|
expect(EQUINE_PATHOLOGIES.length).toBeGreaterThanOrEqual(0)
|
|
expect(EQUINE_PATHOLOGIES.length).toBeLessThanOrEqual(100)
|
|
})
|
|
|
|
it('every entry parses against the schema', () => {
|
|
for (const p of EQUINE_PATHOLOGIES) {
|
|
const r = PathologySchema.safeParse(p)
|
|
if (!r.success) throw new Error(`${p.id}: ${r.error.message}`)
|
|
}
|
|
})
|
|
|
|
it('every entry has at least one source', () => {
|
|
for (const p of EQUINE_PATHOLOGIES) {
|
|
expect(p.sources.length).toBeGreaterThanOrEqual(1)
|
|
}
|
|
})
|
|
|
|
it('every entry is tagged for equine when species-scoped', () => {
|
|
for (const p of EQUINE_PATHOLOGIES) {
|
|
if (p.speciesIds.length > 0) {
|
|
expect(p.speciesIds).toContain('equine')
|
|
}
|
|
}
|
|
})
|
|
|
|
it('every entry has a unique id', () => {
|
|
const ids = new Set<string>()
|
|
for (const p of EQUINE_PATHOLOGIES) {
|
|
expect(ids.has(p.id)).toBe(false)
|
|
ids.add(p.id)
|
|
}
|
|
})
|
|
})
|