import { describe, it, expect } from 'vitest'; import { heroItemFighter1Data } from '@/samples/slay-the-spire-like/data'; describe('heroItemFighter1.csv import', () => { it('should import data as an array', () => { expect(Array.isArray(heroItemFighter1Data)).toBe(true); expect(heroItemFighter1Data.length).toBeGreaterThan(0); }); it('should have expected number of items', () => { // CSV has 24 data rows (excluding header and type rows) expect(heroItemFighter1Data.length).toBe(24); }); it('should have correct fields for each item', () => { for (const item of heroItemFighter1Data) { expect(item).toHaveProperty('type'); expect(item).toHaveProperty('name'); expect(item).toHaveProperty('shape'); expect(item).toHaveProperty('costType'); expect(item).toHaveProperty('costCount'); expect(item).toHaveProperty('targetType'); expect(item).toHaveProperty('desc'); } }); it('should parse costCount as number', () => { for (const item of heroItemFighter1Data) { expect(typeof item.costCount).toBe('number'); } }); it('should contain expected items by name', () => { const names = heroItemFighter1Data.map(item => item.name); expect(names).toContain('剑'); expect(names).toContain('盾'); expect(names).toContain('绷带'); expect(names).toContain('火把'); }); it('should have valid type values', () => { const validTypes = ['weapon', 'armor', 'consumable', 'tool']; for (const item of heroItemFighter1Data) { expect(validTypes).toContain(item.type); } }); it('should have valid costType values', () => { const validCostTypes = ['energy', 'uses']; for (const item of heroItemFighter1Data) { expect(validCostTypes).toContain(item.costType); } }); it('should have valid targetType values', () => { const validTargetTypes = ['single', 'none']; for (const item of heroItemFighter1Data) { expect(validTargetTypes).toContain(item.targetType); } }); it('should have correct item counts by type', () => { const typeCounts = heroItemFighter1Data.reduce((acc, item) => { acc[item.type] = (acc[item.type] || 0) + 1; return acc; }, {} as Record); expect(typeCounts['weapon']).toBe(6); expect(typeCounts['armor']).toBe(6); expect(typeCounts['consumable']).toBe(6); expect(typeCounts['tool']).toBe(6); }); });