import { describe, expect, it } from 'vitest'; import { mapGithubCardForInsert, pokemonSetCardsUrl, pokemonSetsUrl, } from '../../lib/card-import/pokemon-github.js'; describe('pokemon-github URLs', () => { it('builds default pokemon-tcg-data raw GitHub paths', () => { expect(pokemonSetsUrl()).toBe( 'https://raw.githubusercontent.com/PokemonTCG/pokemon-tcg-data/master/sets/en.json' ); expect(pokemonSetCardsUrl('me3')).toBe( 'https://raw.githubusercontent.com/PokemonTCG/pokemon-tcg-data/master/cards/en/me3.json' ); }); }); describe('mapGithubCardForInsert', () => { it('maps card fields and formats collector number with printed total', () => { const mapped = mapGithubCardForInsert( { id: 'me3-18', name: 'Seel', supertype: 'Pokémon', number: '18', rarity: 'Common', types: ['Water'], flavorText: 'The horn on its head is sharp.', hp: '80', images: { small: 'https://images.scrydex.com/pokemon/me3-18/small', large: 'https://images.scrydex.com/pokemon/me3-18/large', }, attacks: [{ damage: '10' }], }, { id: 'me3', name: 'Perfect Order', printedTotal: 88 } ); expect(mapped).toEqual({ externalId: 'me3-18', name: 'Seel', setName: 'Perfect Order', setCode: 'me3', cardNumber: '18/88', rarity: 'Common', cardType: 'Pokémon', types: ['Water'], flavorText: 'The horn on its head is sharp.', hp: '80', imageSmall: 'https://images.scrydex.com/pokemon/me3-18/small', imageLarge: 'https://images.scrydex.com/pokemon/me3-18/large', }); }); });