import { expect, test } from 'bun:test'; import { HWATU, SEOTDA_DECK, cardLabel, hwatu, hwatuBonus, rankValue, standardDeck } from './cards'; test('standard deck', () => { const d = standardDeck(2); expect(d).toHaveLength(54); expect(new Set(d).size).toBe(54); expect(rankValue('AS')).toBe(14); expect(rankValue('2C')).toBe(2); expect(cardLabel('TD')).toBe('◆10'); expect(cardLabel('X1')).toBe('조커'); }); test('hwatu composition matches gostop.md §3.1', () => { expect(HWATU).toHaveLength(48); const count = (k: string) => HWATU.filter((c) => c.kind === k).length; expect([count('gwang'), count('yeol'), count('tti'), count('pi') + count('ssangpi')]).toEqual([5, 9, 10, 24]); expect(HWATU.filter((c) => c.kind === 'ssangpi').map((c) => c.id)).toEqual([41, 47]); expect(HWATU.filter((c) => c.tags.includes('godori')).map((c) => c.id)).toEqual([4, 12, 29]); expect(hwatu(32).tags).toContain('gukjin'); expect(hwatu(44).name).toBe('12월 비광(비)'); expect(HWATU.every((c) => c.month === Math.floor(c.id / 4) + 1)).toBe(true); expect(hwatuBonus(3).map((c) => c.piValue)).toEqual([2, 2, 3]); }); test('seotda deck: 20 cards, months 1–10 twice, 광 1·3·8, 열끗 4·7·9 specials', () => { expect(SEOTDA_DECK).toHaveLength(20); const months = SEOTDA_DECK.map((id) => hwatu(id).month).sort((a, b) => a - b); expect(months).toEqual([1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]); expect(SEOTDA_DECK.filter((id) => hwatu(id).kind === 'gwang').map((id) => hwatu(id).month)).toEqual([1, 3, 8]); expect([12, 24, 32].every((id) => SEOTDA_DECK.includes(id) && hwatu(id).kind === 'yeol')).toBe(true); });