test: add unit tests for core game logic utilities
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m22s

Add 5 new test files covering pure utility functions:
- discipline-math.test.ts (42 tests): stat bonus, mana drain, perk tiers,
  discipline activation/progression, unlocked perks, discipline stats
- formatting.test.ts (35 tests): fmt, fmtDec, formatSpellCost,
  getSpellCostColor, formatStudyTime, formatHour
- floor-utils.test.ts (13 tests): getFloorMaxHP, getFloorElement
- combat-utils.test.ts (37 tests): getElementalBonus, getBoonBonuses,
  getIncursionStrength, canAffordSpellCost, deductSpellCost
- mana-utils.test.ts (36 tests): computeMaxMana, computeRegen,
  computeClickMana, getMeditationBonus, computeEffectiveRegenForDisplay

Total: 163 new tests, all passing. No existing tests broken.
This commit is contained in:
2026-05-20 13:01:15 +02:00
parent cba42e01ff
commit a49b8a8bef
8 changed files with 1306 additions and 32 deletions
+2 -30
View File
@@ -1,6 +1,6 @@
{
"_meta": {
"generated": "2026-05-20T10:00:49.725Z",
"generated": "2026-05-20T10:36:02.953Z",
"description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.",
"usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry."
},
@@ -156,25 +156,6 @@
"crafting-utils.ts",
"types.ts"
],
"crafting-slice.ts": [
"constants.ts",
"crafting-actions/index.ts",
"crafting-apply.ts",
"crafting-attunements.ts",
"crafting-design.ts",
"crafting-equipment.ts",
"crafting-loot.ts",
"crafting-prep.ts",
"crafting-utils.ts",
"data/attunements.ts",
"data/crafting-recipes.ts",
"data/enchantment-effects.ts",
"data/equipment/index.ts",
"effects/special-effects.ts",
"effects/upgrade-effects.ts",
"effects/upgrade-effects.types.ts",
"types.ts"
],
"crafting-utils.ts": [
"data/crafting-recipes.ts",
"data/enchantment-effects.ts",
@@ -415,15 +396,6 @@
"utils/index.ts",
"utils/pact-utils.ts"
],
"store.ts": [
"types.ts",
"utils/activity-log.ts",
"utils/combat-utils.ts",
"utils/floor-utils.ts",
"utils/formatting.ts",
"utils/mana-utils.ts",
"utils/room-utils.ts"
],
"stores/attunementStore.ts": [
"data/attunements.ts",
"types.ts"
@@ -454,7 +426,6 @@
"crafting-actions/preparation-actions.ts",
"crafting-design.ts",
"crafting-equipment.ts",
"crafting-slice.ts",
"crafting-utils.ts",
"stores/combatStore.ts",
"stores/craftingStore.types.ts",
@@ -529,6 +500,7 @@
"stores/combat-state.types.ts",
"stores/combatStore.ts",
"stores/craftingStore.ts",
"stores/craftingStore.types.ts",
"stores/discipline-slice.ts",
"stores/gameHooks.ts",
"stores/gameStore.ts",