Skip to content

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

Description

@grantfox-oss

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Why this matters

stores.test.ts explicitly tests useUserStore/useWalletStore/useUIStore/useThemeStore but never imports useGamificationStore, leaving its real logic untested: addXP -> checkLevelUp transitions (useGamificationStore.ts:210-254), calculateLevel threshold boundaries (125-132), getNextLevelInfo math (346-376), and unlockAchievement/updateAchievementProgress clamping (264-298).

Acceptance criteria

  • Test addXP crossing each LEVEL_THRESHOLDS boundary sets level, kingdomTitle, showLevelUpModal, pendingLevelUp
  • Test calculateLevel/getNextLevelInfo at exact and below-threshold XP values, and progress clamping to [0,100]
  • Test updateAchievementProgress sets unlockedAt exactly once when progress reaches maxProgress

Files to touch

  • frontend/src/app/stores/useGamificationStore.ts
  • frontend/src/app/stores/stores.test.ts

Out of scope

  • Gamification persisting transient state (already filed)

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programfrontendIssues related to frontend developmentgood first issueGood for newcomerstestingAdding or fixing tests

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions