Skip to content

test: add useGamificationStore XP and level-up unit tests#1273

Merged
ogazboiz merged 1 commit into
LabsCrypt:mainfrom
kingbitnation:issue/1225-gamification-store-tests
Jun 29, 2026
Merged

test: add useGamificationStore XP and level-up unit tests#1273
ogazboiz merged 1 commit into
LabsCrypt:mainfrom
kingbitnation:issue/1225-gamification-store-tests

Conversation

@kingbitnation

Copy link
Copy Markdown
Contributor

Summary

  • Adds useGamificationStore coverage to stores.test.ts, matching the other store test suites
  • Tests addXP / checkLevelUp at every LEVEL_THRESHOLDS boundary (level, kingdomTitle, showLevelUpModal, pendingLevelUp)
  • Tests getNextLevelInfo / calculateLevel at exact and below-threshold XP values, including progress clamping to [0, 100]
  • Tests unlockAchievement and updateAchievementProgress (including unlockedAt set exactly once when progress reaches maxProgress)

Test plan

  • npm test -- stores.test.ts (41 tests passing)

Closes #1225

Cover addXP threshold crossings, getNextLevelInfo/calculateLevel boundaries, and achievement unlock progress clamping in stores.test.ts.

Closes LabsCrypt#1225
@kingbitnation kingbitnation force-pushed the issue/1225-gamification-store-tests branch from 1d01217 to 17df911 Compare June 29, 2026 08:52
@ogazboiz ogazboiz merged commit 51e028d into LabsCrypt:main Jun 29, 2026
4 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Testing] useGamificationStore XP/level-up logic has zero unit tests despite stores.test.ts covering every other store

2 participants