import { describe, it, expect } from 'vitest'; import { TAROT_DECK, findCard, CATEGORIES } from '../tarot/cards'; describe('TAROT_DECK', () => { it('78장이다', () => { expect(TAROT_DECK).toHaveLength(78); }); it('slug가 고유하다', () => { const slugs = TAROT_DECK.map((c) => c.slug); expect(new Set(slugs).size).toBe(78); }); it('메이저 22 + 마이너 56', () => { expect(TAROT_DECK.filter((c) => c.arcana === 'major')).toHaveLength(22); expect(TAROT_DECK.filter((c) => c.arcana === 'minor')).toHaveLength(56); }); it('모든 카드에 필수 필드가 채워져 있다', () => { for (const c of TAROT_DECK) { expect(c.name.length).toBeGreaterThan(0); expect(c.nameEn.length).toBeGreaterThan(0); expect(c.keywords.length).toBeGreaterThan(0); expect(c.reversedKeywords.length).toBeGreaterThan(0); expect(c.meaningUpright.length).toBeGreaterThan(0); expect(c.meaningReversed.length).toBeGreaterThan(0); expect(c.image).toMatch(/^\/images\/tarot\/cards\/[a-z0-9-]+\.png$/); } }); it('findCard가 slug로 카드를 찾는다', () => { expect(findCard('the-fool')?.nameEn).toBe('The Fool'); expect(findCard('nonexistent')).toBeUndefined(); }); it('CATEGORIES는 6개', () => { expect(CATEGORIES).toHaveLength(6); }); });