Skip to content

Add tests for auth middleware, clan missions, admin roles, and pvp-config - #182

Open
Sparksx wants to merge 1 commit into
mainfrom
claude/vigilant-rubin-e0gd6w
Open

Add tests for auth middleware, clan missions, admin roles, and pvp-config#182
Sparksx wants to merge 1 commit into
mainfrom
claude/vigilant-rubin-e0gd6w

Conversation

@Sparksx

@Sparksx Sparksx commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Auth middleware tests (13 cases): requireAuth header parsing, JWT verification, token expiry handling; requireRole role matching and DB error handling; socketAuth WebSocket JWT verification
  • Auth route contract tests (10 cases): module load safety, guest username format (Hero_ + 6 hex chars), default game state shape, settings/profile-picture validation boundaries
  • Clan missions tracker tests (10 cases): event-bus wiring for forge/defeat/boss/arena events, full-gear-swap detection across all 8 equipment slots, flush debouncing, inactive mission type dropping, clan perk refresh on mission completion
  • Admin role helper tests (11 cases): getUserRole, isStaff, isAdmin across all role states including null/missing user
  • PvP config constant tests (6 cases): matchmaking constant invariants — completes full shared/ directory coverage

Test plan

  • All 574 tests pass (npx vitest run)
  • ESLint clean on all new test files
  • No changes to production code — test-only additions

🤖 Generated with Claude Code

https://claude.ai/code/session_01H5e2sXbt71QfTpEXEPSkpf


Generated by Claude Code

…nfig

Covers 5 previously untested modules with 50 new test cases:
- server/middleware/auth: requireAuth, requireRole, socketAuth (JWT, roles, socket)
- server/routes/auth: module load safety, guest username format, validation contracts
- src/game/clan-missions: event wiring, full-gear-swap detection, flush debouncing
- src/game/admin: getUserRole, isStaff, isAdmin across all role states
- shared/pvp-config: matchmaking constant invariants (completes shared/ coverage)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H5e2sXbt71QfTpEXEPSkpf
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.

2 participants