refactor: add status cards and rules.
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
enemyDesertData,
|
||||
enemyIntentDesertData,
|
||||
effectDesertData,
|
||||
statusCardDesertData,
|
||||
} from '@/samples/slay-the-spire-like/data';
|
||||
|
||||
describe('heroItemFighter1.csv import', () => {
|
||||
@@ -258,3 +259,53 @@ describe('enemyIntentDesert.csv import', () => {
|
||||
expect(enemyIds.size).toBe(14);
|
||||
});
|
||||
});
|
||||
|
||||
describe('statusCardDesert.csv import', () => {
|
||||
it('should import data as an array', () => {
|
||||
expect(Array.isArray(statusCardDesertData)).toBe(true);
|
||||
expect(statusCardDesertData.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should have expected number of status cards', () => {
|
||||
expect(statusCardDesertData.length).toBe(4);
|
||||
});
|
||||
|
||||
it('should have correct fields for each status card', () => {
|
||||
for (const card of statusCardDesertData) {
|
||||
expect(card).toHaveProperty('id');
|
||||
expect(card).toHaveProperty('name');
|
||||
expect(card).toHaveProperty('desc');
|
||||
expect(card).toHaveProperty('unplayable');
|
||||
expect(card).toHaveProperty('effects');
|
||||
expect(typeof card.id).toBe('string');
|
||||
expect(typeof card.name).toBe('string');
|
||||
expect(typeof card.desc).toBe('string');
|
||||
expect(typeof card.unplayable).toBe('boolean');
|
||||
}
|
||||
});
|
||||
|
||||
it('should have all cards unplayable', () => {
|
||||
for (const card of statusCardDesertData) {
|
||||
expect(card.unplayable).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it('should have effects with target, effect ref, and value', () => {
|
||||
for (const card of statusCardDesertData) {
|
||||
expect(Array.isArray(card.effects)).toBe(true);
|
||||
for (const [target, effect, value] of card.effects) {
|
||||
expect(target).toBe('self');
|
||||
expect(typeof effect === 'string' || typeof effect === 'object').toBe(true);
|
||||
expect(typeof value).toBe('number');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('should contain expected status cards by id', () => {
|
||||
const ids = statusCardDesertData.map(c => c.id);
|
||||
expect(ids).toContain('wound');
|
||||
expect(ids).toContain('venom');
|
||||
expect(ids).toContain('curse');
|
||||
expect(ids).toContain('static');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user