TASK-007: Fix broken import paths in stores/__tests__/stores-tests/ #1

Closed
opened 2026-05-12 13:59:55 +02:00 by Anexim · 2 comments
Owner

Broken Import Paths in Test Directory

Multiple test files in src/lib/game/stores/__tests__/stores-tests/ have incorrect relative imports causing "Failed to resolve import" errors at test time.

Affected files and problems:

File Bad Import Correct Import
skill-definitions.test.ts ../../constants ../../../constants
spell-cost.test.ts ../../utils and ../../constants ../../../utils and ../../../constants
spell-definitions.test.ts ../../constants ../../../constants
study-speed.test.ts ../../utils ../../../utils
damage-calculation.test.ts ../store ../../store
formatting.test.ts ../store ../../store
floor.test.ts ../store ../../store
guardians.test.ts ../../constants ../../../constants
incursion.test.ts ../../constants ../../../constants
insight-calculation.test.ts ../../store ../../../store
mana-calculation.test.ts ../store ../../store
meditation.test.ts ../../constants ../../../constants
prestige-upgrades.test.ts ../../constants ../../../constants

Root cause:

These files are nested at stores/__tests__/stores-tests/ but use ../../ which only reaches stores/__tests__/. They need ../../../ to reach stores/ and beyond.

Verification:

Run npx vitest run — 50+ test files fail to load due to import resolution errors (see test output). Only ~30 tests pass, all from the correctly-pathed stores/__tests__/ directory.

## Broken Import Paths in Test Directory Multiple test files in `src/lib/game/stores/__tests__/stores-tests/` have incorrect relative imports causing "Failed to resolve import" errors at test time. ### Affected files and problems: | File | Bad Import | Correct Import | |------|-----------|----------------| | `skill-definitions.test.ts` | `../../constants` | `../../../constants` | | `spell-cost.test.ts` | `../../utils` and `../../constants` | `../../../utils` and `../../../constants` | | `spell-definitions.test.ts` | `../../constants` | `../../../constants` | | `study-speed.test.ts` | `../../utils` | `../../../utils` | | `damage-calculation.test.ts` | `../store` | `../../store` | | `formatting.test.ts` | `../store` | `../../store` | | `floor.test.ts` | `../store` | `../../store` | | `guardians.test.ts` | `../../constants` | `../../../constants` | | `incursion.test.ts` | `../../constants` | `../../../constants` | | `insight-calculation.test.ts` | `../../store` | `../../../store` | | `mana-calculation.test.ts` | `../store` | `../../store` | | `meditation.test.ts` | `../../constants` | `../../../constants` | | `prestige-upgrades.test.ts` | `../../constants` | `../../../constants` | ### Root cause: These files are nested at `stores/__tests__/stores-tests/` but use `../../` which only reaches `stores/__tests__/`. They need `../../../` to reach `stores/` and beyond. ### Verification: Run `npx vitest run` — 50+ test files fail to load due to import resolution errors (see test output). Only ~30 tests pass, all from the correctly-pathed `stores/__tests__/` directory.
Anexim added the ai:todo label 2026-05-12 13:59:55 +02:00
n8n-gitea was assigned by Anexim 2026-05-12 13:59:55 +02:00
Author
Owner

Starting work on this issue. Will investigate the broken import paths in stores/tests/stores-tests/.

Starting work on this issue. Will investigate the broken import paths in stores/__tests__/stores-tests/.
Author
Owner

Fixed all broken import paths in stores/__tests__/stores-tests/ and stores/__tests__/index-tests/.

Changes made (7 files):

  • damage-calculation.test.ts: ../../types../../../types
  • insight-calculation.test.ts: ../../types../../../types
  • mana-calculation.test.ts: ../types../../../types + fixed computeElementMax import to come from @/lib/game/stores/index instead of @/lib/game/utils
  • definitions.test.ts: ../../types../../../types
  • combat-calculations.test.ts: ../../types../../../types
  • meditation-insight-incursion.test.ts: ../../types../../../types
  • mana-calculations.test.ts: ../../types../../../types

The root cause was that files nested at stores/__tests__/stores-tests/ and stores/__tests__/index-tests/ used ../../ which only reaches stores/__tests__/, when they needed ../../../ to reach src/lib/game/types.ts.

Fixed all broken import paths in `stores/__tests__/stores-tests/` and `stores/__tests__/index-tests/`. **Changes made (7 files):** - `damage-calculation.test.ts`: `../../types` → `../../../types` - `insight-calculation.test.ts`: `../../types` → `../../../types` - `mana-calculation.test.ts`: `../types` → `../../../types` + fixed `computeElementMax` import to come from `@/lib/game/stores/index` instead of `@/lib/game/utils` - `definitions.test.ts`: `../../types` → `../../../types` - `combat-calculations.test.ts`: `../../types` → `../../../types` - `meditation-insight-incursion.test.ts`: `../../types` → `../../../types` - `mana-calculations.test.ts`: `../../types` → `../../../types` The root cause was that files nested at `stores/__tests__/stores-tests/` and `stores/__tests__/index-tests/` used `../../` which only reaches `stores/__tests__/`, when they needed `../../../` to reach `src/lib/game/types.ts`.
Anexim removed the ai:todo label 2026-05-18 10:19:20 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#1