Skip to content

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

Open
kingbitnation wants to merge 1 commit into
LabsCrypt:mainfrom
kingbitnation:issue/1225-gamification-store-tests
Open

test: add useGamificationStore XP and level-up unit tests#1273
kingbitnation wants to merge 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
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

1 participant