test(species): pin pathology DB integrity contract (empty allowed in v1)
This commit is contained in:
1 parent
a3a4d4e1f6
commit
3ea8f522c0
1 file changed
+39
@@ -0,0 +1,39 @@
|
|||||||
|
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)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in new issue
Block a user