Multiplayer GameService unit tests #51

Open
opened 2026-04-19 07:23:42 +00:00 by forgejo-lila · 0 comments
Owner

Context

Multiplayer game logic needs thorough testing across all game modes.

Files to create

  • apps/api/src/services/multiplayerGameService.test.ts

Test cases

General: question generation, score calculation, cumulative scores.
Elimination: wrong = eliminated, last standing wins, all wrong same round, single remaining.
Race to the Top: first to target wins, same-round tie, correct tracking.
Chain Link: turn order maintained, wrong on your turn ends game.
TV Quiz Show: first buzz priority, correct/wrong buzz scoring, no buzz timeout.
Timer: timeout triggers evaluation, answers after timeout rejected.

Acceptance criteria

  • All game modes: happy path and edge cases
  • Mocked DB (consistent with gameService.test.ts pattern)
  • Fast tests (mock timers with vi.useFakeTimers())
  • Edge cases: 2 players, max players, simultaneous events

Notes

Reference: apps/api/src/services/gameService.test.ts. Use vi.mock for DB mocking.

## Context Multiplayer game logic needs thorough testing across all game modes. ## Files to create - `apps/api/src/services/multiplayerGameService.test.ts` ## Test cases **General:** question generation, score calculation, cumulative scores. **Elimination:** wrong = eliminated, last standing wins, all wrong same round, single remaining. **Race to the Top:** first to target wins, same-round tie, correct tracking. **Chain Link:** turn order maintained, wrong on your turn ends game. **TV Quiz Show:** first buzz priority, correct/wrong buzz scoring, no buzz timeout. **Timer:** timeout triggers evaluation, answers after timeout rejected. ## Acceptance criteria - All game modes: happy path and edge cases - Mocked DB (consistent with `gameService.test.ts` pattern) - Fast tests (mock timers with `vi.useFakeTimers()`) - Edge cases: 2 players, max players, simultaneous events ## Notes Reference: `apps/api/src/services/gameService.test.ts`. Use `vi.mock` for DB mocking.
forgejo-lila added the
multiplayer
label 2026-04-19 07:23:42 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: forgejo-lila/lila#51
No description provided.