Files
Mana-Loop/src/lib/game/store-tests/element-recipes.test.ts
T
Refactoring Agent d2d28887b1
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m9s
Refactor large files into modular components
- Refactored page.tsx (613→252 lines) with GameOverScreen and LeftPanel extracted
- Refactored StatsTab.tsx (584→92 lines) with section components
- Refactored SkillsTab.tsx (434→54 lines) with sub-components
- Created modular structure for GameContext, LootInventory, and other components
- All extracted components organized into feature directories
2026-05-02 17:35:03 +02:00

33 lines
908 B
TypeScript

/**
* Tests for Element Crafting Recipes
*/
import { describe, it, expect } from 'vitest';
import { ELEMENTS } from '../constants';
describe('Element Crafting Recipes', () => {
it('should have valid ingredient references', () => {
Object.entries(ELEMENTS).forEach(([id, def]) => {
if (def.recipe) {
def.recipe.forEach(ingredient => {
expect(ELEMENTS[ingredient]).toBeDefined();
});
}
});
});
it('should not have circular recipes', () => {
const visited = new Set<string>();
const checkCircular = (id: string, path: string[]): boolean => {
if (path.includes(id)) return true;
const def = ELEMENTS[id];
if (!def.recipe) return false;
return def.recipe.some(ing => checkCircular(ing, [...path, id]));
};
Object.keys(ELEMENTS).forEach(id => {
expect(checkCircular(id, [])).toBe(false);
});
});
});