From 3dc715336135a9bb92ac2bb03c50c73f47e5fb28 Mon Sep 17 00:00:00 2001 From: Bastien Chanot Date: Mon, 18 May 2026 21:00:36 +0200 Subject: [PATCH] test(species): cover registry lookup + equine manifest --- tests/unit/species.registry.test.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/unit/species.registry.test.ts diff --git a/tests/unit/species.registry.test.ts b/tests/unit/species.registry.test.ts new file mode 100644 index 00000000..f1a2b040 --- /dev/null +++ b/tests/unit/species.registry.test.ts @@ -0,0 +1,23 @@ +import { describe, it, expect } from 'vitest' +import { getSpecies, getAllSpecies } from '@/domain/species/registry' + +describe('species registry', () => { + it('returns the equine manifest', () => { + const eq = getSpecies('equine') + expect(eq).toBeDefined() + expect(eq?.labelFr).toBe('Cheval') + expect(eq?.mainSvg).toBe('/species/equine/Horse.svg') + expect(eq?.details.head).toBe('/species/equine/Horse_head.svg') + expect(eq?.vertebralFormula).toEqual({ C: 7, T: 18, L: 6, S: 5, Cd: 18 }) + }) + + it('returns undefined for unknown species', () => { + expect(getSpecies('martian')).toBeUndefined() + }) + + it('lists at least the equine species', () => { + const all = getAllSpecies() + expect(all.length).toBeGreaterThanOrEqual(1) + expect(all.find((s) => s.id === 'equine')).toBeDefined() + }) +})