fix: correct broken import paths in test files (stores-tests and index-tests)
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 31s

Files in stores/__tests__/stores-tests/ and stores/__tests__/index-tests/
used relative paths (../../types or ../types) that resolved incorrectly.
Fixed all to use '../../../types' to properly reach src/lib/game/types.ts.

Also fixed mana-calculation.test.ts to import computeElementMax from
the correct location (@/lib/game/stores/index instead of @/lib/game/utils).
This commit is contained in:
2026-05-13 23:33:33 +02:00
parent 07b311bd7a
commit ba231ac9dd
8 changed files with 25 additions and 64 deletions
@@ -4,14 +4,15 @@
import { describe, it, expect } from 'vitest';
import { calcDamage, getFloorMaxHP, getFloorElement } from '@/lib/game/stores/index';
import type { GameState } from '../types';
import { GUARDIANS } from '@/lib/game/constants';
import type { GameState } from '../../../types';
function createMockState(overrides: Partial<GameState> = {}): GameState {
const elements: Record<string, { current: number; max: number; unlocked: boolean }> = {};
['fire', 'water', 'air', 'earth', 'light', 'dark', 'death', 'transference', 'metal', 'sand', 'crystal', 'stellar', 'void', 'lightning'].forEach((k) => {
elements[k] = { current: 0, max: 10, unlocked: ['fire', 'water', 'air', 'earth'].includes(k) };
});
return {
day: 1,
hour: 0,
@@ -35,7 +36,7 @@ function createMockState(overrides: Partial<GameState> = {}): GameState {
activeSpell: 'manaBolt',
currentAction: 'meditate',
castProgress: 0,
spells: {
spells: {
manaBolt: { learned: true, level: 1, studyProgress: 0 },
fireball: { learned: true, level: 1, studyProgress: 0 },
waterJet: { learned: true, level: 1, studyProgress: 0 },
@@ -111,8 +112,6 @@ describe('Combat Calculations', () => {
describe('getFloorMaxHP', () => {
it('should return guardian HP for guardian floors', () => {
// Import GUARDIANS from constants
import { GUARDIANS } from '@/lib/game/constants';
expect(getFloorMaxHP(10)).toBe(GUARDIANS[10].hp);
expect(getFloorMaxHP(100)).toBe(GUARDIANS[100].hp);
});
@@ -145,4 +144,4 @@ describe('Combat Calculations', () => {
});
});
console.log('✅ Combat calculation tests defined.');
console.log('✅ Combat calculation tests defined.');
@@ -4,10 +4,11 @@
import { describe, it, expect } from 'vitest';
import { SKILLS_DEF, PRESTIGE_DEF, GUARDIANS } from '@/lib/game/constants';
import type { GameState } from '../../../types';
describe('Skill Definitions', () => {
it('all skills should have valid categories', () => {
const validCategories = ['mana', 'study', 'research', 'ascension', 'enchant',
const validCategories = ['mana', 'study', 'research', 'ascension', 'enchant',
'effectResearch', 'invocation', 'pact', 'fabrication', 'golemancy', 'craft', 'hybrid'];
Object.values(SKILLS_DEF).forEach(skill => {
expect(validCategories).toContain(skill.cat);
@@ -94,4 +95,4 @@ describe('Guardian Definitions', () => {
});
});
console.log('✅ Skill, prestige, and guardian definition tests defined.');
console.log('✅ Skill, prestige, and guardian definition tests defined.');
@@ -4,7 +4,7 @@
import { describe, it, expect } from 'vitest';
import { computeMaxMana, computeRegen, computeClickMana, computeElementMax } from '@/lib/game/stores/index';
import type { GameState } from '../types';
import type { GameState } from '../../../types';
import { ELEMENTS } from '@/lib/game/constants';
function createMockState(overrides: Partial<GameState> = {}): GameState {
@@ -12,7 +12,7 @@ function createMockState(overrides: Partial<GameState> = {}): GameState {
Object.keys(ELEMENTS).forEach((k) => {
elements[k] = { current: 0, max: 10, unlocked: ['fire', 'water', 'air', 'earth'].includes(k) };
});
return {
day: 1,
hour: 0,
@@ -53,13 +53,6 @@ function createMockState(overrides: Partial<GameState> = {}): GameState {
containmentWards: 0,
log: [],
loopInsight: 0,
equipment: { mainHand: null, offHand: null, head: null, body: null, hands: null, accessory: null },
inventory: [],
blueprints: {},
schedule: [],
autoSchedule: false,
studyQueue: [],
craftQueue: [],
attunements: {
enchanter: { id: 'enchanter', active: true, level: 1, experience: 0 },
invoker: { id: 'invoker', active: false, level: 1, experience: 0 },
@@ -92,7 +85,7 @@ describe('Mana Calculations', () => {
const state = createMockState({ prestigeUpgrades: { manaWell: 3 } });
expect(computeMaxMana(state)).toBe(100 + 3 * 500);
});
it('should stack manaWell skill and prestige', () => {
const state = createMockState({
skills: { manaWell: 5 },
@@ -168,4 +161,4 @@ describe('Mana Calculations', () => {
});
});
console.log('✅ Mana calculation tests defined.');
console.log('✅ Mana calculation tests defined.');
@@ -5,14 +5,14 @@
import { describe, it, expect } from 'vitest';
import { getMeditationBonus, calcInsight, getIncursionStrength } from '@/lib/game/stores/index';
import { MAX_DAY, INCURSION_START_DAY } from '@/lib/game/constants';
import type { GameState } from '../types';
import type { GameState } from '../../../types';
function createMockState(overrides: Partial<GameState> = {}): GameState {
const elements: Record<string, { current: number; max: number; unlocked: boolean }> = {};
['fire', 'water', 'air', 'earth', 'light', 'dark', 'death', 'transference'].forEach((k) => {
elements[k] = { current: 0, max: 10, unlocked: ['fire', 'water', 'air', 'earth'].includes(k) };
});
return {
day: 1,
hour: 0,
@@ -80,7 +80,7 @@ describe('Meditation Bonus', () => {
it('should ramp up over time', () => {
const bonus1hr = getMeditationBonus(25, {}); // 1 hour of ticks
expect(bonus1hr).toBeGreaterThan(1);
const bonus4hr = getMeditationBonus(100, {}); // 4 hours
expect(bonus4hr).toBeGreaterThan(bonus1hr);
});
@@ -177,4 +177,4 @@ describe('Incursion Strength', () => {
});
});
console.log('✅ Meditation, insight, and incursion tests defined.');
console.log('✅ Meditation, insight, and incursion tests defined.');
@@ -4,7 +4,7 @@
import { describe, it, expect } from 'vitest';
import { calcDamage } from '@/lib/game/utils';
import type { GameState } from '../../types';
import type { GameState } from '../../../types';
import { ELEMENTS } from '@/lib/game/constants';
function createMockState(overrides: Partial<GameState> = {}): GameState {
@@ -4,7 +4,7 @@
import { describe, it, expect } from 'vitest';
import { calcInsight } from '@/lib/game/utils';
import type { GameState } from '../../types';
import type { GameState } from '../../../types';
import { ELEMENTS } from '@/lib/game/constants';
function createMockState(overrides: Partial<GameState> = {}): GameState {
@@ -3,8 +3,9 @@
*/
import { describe, it, expect } from 'vitest';
import { computeMaxMana, computeElementMax, computeRegen, computeClickMana } from '@/lib/game/utils';
import type { GameState } from '../../types';
import { computeMaxMana, computeRegen, computeClickMana } from '@/lib/game/utils';
import { computeElementMax } from '@/lib/game/stores/index';
import type { GameState } from '../../../types';
import { ELEMENTS } from '@/lib/game/constants';
function createMockState(overrides: Partial<GameState> = {}): GameState {
@@ -12,7 +13,7 @@ function createMockState(overrides: Partial<GameState> = {}): GameState {
Object.keys(ELEMENTS).forEach((k) => {
elements[k] = { current: 0, max: 10, unlocked: ['fire', 'water', 'air', 'earth'].includes(k) };
});
return {
day: 1,
hour: 0,
@@ -104,7 +105,7 @@ describe('Mana Calculation Functions', () => {
const state = createMockState({ prestigeUpgrades: { manaWell: 3 } });
expect(computeMaxMana(state)).toBe(100 + 3 * 500);
});
it('should stack manaWell skill and prestige', () => {
const state = createMockState({
skills: { manaWell: 5 },
@@ -118,7 +119,7 @@ describe('Mana Calculation Functions', () => {
// Base regen is 2, but computeRegen now includes attunement regen
// Enchanter (active, level 1) adds rawManaRegen * 1.5^0 = rawManaRegen
// Default enchanter rawManaRegen is 0.5, so base with enchanter = 2 + 0.5 = 2.5
it('should return base regen with no upgrades (includes attunement regen)', () => {
const state = createMockState();
// Base 2 + enchanter regen (0.5 * 1 = 0.5) = 2.5
@@ -184,4 +185,4 @@ describe('Mana Calculation Functions', () => {
});
});
console.log('✅ Mana calculation tests defined (from stores/__tests__/stores.test.ts).');
console.log('✅ Mana calculation tests defined (from stores/__tests__/stores.test.ts).');