import { readFileSync } from 'node:fs'; import { describe, expect, it } from 'vitest'; const catalog = JSON.parse(readFileSync('data/pokemon-catalog.json', 'utf8')) as { pokemon: { number: number; name: string; hp: number; type1: string }[]; games: { sourceId: number; name: string }[]; entries: [number, number, string][]; }; describe('Pokémon catalog snapshot', () => { it('contains the national species catalog and the latest source versions', () => { expect(catalog.pokemon).toHaveLength(1025); expect(catalog.games.length).toBeGreaterThanOrEqual(53); expect(catalog.pokemon.find((p) => p.number === 25)).toMatchObject({ name: 'Pikachu', type1: 'Electric', hp: 35 }); expect(catalog.games.some((g) => g.name.includes('Z-A'))).toBe(true); }); it('has unique species, games, and valid entry references', () => { const pokemon = new Set(catalog.pokemon.map((p) => p.number)); const games = new Set(catalog.games.map((g) => g.sourceId)); expect(pokemon.size).toBe(catalog.pokemon.length); expect(games.size).toBe(catalog.games.length); expect(new Set(catalog.entries.map(([p, g]) => `${p}/${g}`)).size).toBe(catalog.entries.length); expect( catalog.entries.every( ([p, g, a]) => pokemon.has(p) && games.has(g) && ['catchable', 'unknown'].includes(a) ) ).toBe(true); }); it('does not invent exclusive availability from missing encounters', () => { expect(catalog.entries.some(([, , a]) => a === 'catchable')).toBe(true); expect(catalog.entries.some(([, , a]) => a === 'unknown')).toBe(true); }); });