Commit Graph

1 Commits

Author SHA1 Message Date
Alexander Whitestone
d4b1bbdce4 test: add 39 unit tests for utils.js (#57)
Some checks failed
Accessibility Checks / a11y-audit (pull_request) Successful in 5s
Smoke Test / smoke (pull_request) Failing after 9s
Comprehensive coverage of pure utility functions:

- fmt(): null/NaN/Infinity, negatives, small numbers, scale
  abbreviations (K through Dc), spellf handoff at undecillion
- spellf(): edge cases, small numbers (0-999), thousands,
  millions+, negative numbers, large scale names (decillion,
  undecillion, vigintillion)
- getScaleName(): empty for small, correct names through quadrillion
- getBuildingCost(): unknown, base cost, scaling, multi-resource
- canAffordBuilding/spendBuilding: sufficient, insufficient,
  multi-resource check, deduction
- canAffordProject/spendProject: cost checking and spending
- getMaxBuyable(): zero when broke, positive counts, unknown
- getBulkCost(): zero qty, unknown, single matches getBuildingCost,
  cumulative math
- getClickPower(): base, autocoder, phase, codeBoost, combined
- showToast(): no-op guards (isLoading, no container)

All 74 tests pass (39 new + 10 dismantle + 25 emergent-mechanics).
Smoke test passes. Syntax checks pass.
2026-04-21 00:34:26 -04:00