Refactor large files into modular components
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m9s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m9s
- 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
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 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);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user