From 7a6eb0b88e0566a370013eb12f5cfb7873b7825b Mon Sep 17 00:00:00 2001 From: DEV-bot Date: Sun, 15 Mar 2026 16:51:21 +0000 Subject: [PATCH] fix(frontend): restore canonical reveal payload typecheck --- frontend/src/api/client.ts | 10 +++++----- frontend/tests/gameplay-phase-machine.test.ts | 2 ++ frontend/tests/vertical-slice.test.ts | 11 ++++++++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index 397365c..02b3775 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -4,10 +4,10 @@ import { mapHealthResponse, mapJoinSessionResponse, mapMixAnswersResponse, - mapNextRoundResponse, mapScoreboardResponse, mapSessionDetailResponse, mapShowQuestionResponse, + mapStartNextRoundResponse, mapStartRoundResponse, mapSubmitGuessResponse, mapSubmitLieResponse @@ -20,10 +20,10 @@ import type { JoinSessionRequest, JoinSessionResponse, MixAnswersResponse, - NextRoundResponse, ScoreboardResponse, SessionDetailResponse, ShowQuestionResponse, + StartNextRoundResponse, StartRoundRequest, StartRoundResponse, SubmitGuessRequest, @@ -41,7 +41,7 @@ export interface ApiClient { mixAnswers(code: string, roundQuestionId: number): Promise>; calculateScores(code: string, roundQuestionId: number): Promise>; getScoreboard(code: string): Promise>; - startNextRound(code: string): Promise>; + startNextRound(code: string): Promise>; finishGame(code: string): Promise>; submitLie(code: string, roundQuestionId: number, payload: SubmitLieRequest): Promise>; submitGuess(code: string, roundQuestionId: number, payload: SubmitGuessRequest): Promise>; @@ -167,10 +167,10 @@ export function createApiClient(baseUrl = '', fetchImpl: typeof fetch = fetch): mapScoreboardResponse ), startNextRound: (code: string) => - request( + request( `/lobby/sessions/${encodeURIComponent(normalizeCode(code))}/rounds/next`, 'POST', - mapNextRoundResponse, + mapStartNextRoundResponse, {} ), finishGame: (code: string) => diff --git a/frontend/tests/gameplay-phase-machine.test.ts b/frontend/tests/gameplay-phase-machine.test.ts index 2d71a7b..420d822 100644 --- a/frontend/tests/gameplay-phase-machine.test.ts +++ b/frontend/tests/gameplay-phase-machine.test.ts @@ -40,6 +40,7 @@ describe('gameplay phase machine skeleton', () => { session: { code: 'ABCD12', status: 'lie', host_id: 1, current_round: 1, players_count: 3 }, players: [], round_question: null, + reveal: null, phase_view_model: { status: 'lie', round_number: 1, @@ -74,6 +75,7 @@ describe('gameplay phase machine skeleton', () => { session: { code: 'ABCD12', status: 'finished', host_id: 1, current_round: 1, players_count: 3 }, players: [], round_question: null, + reveal: null, phase_view_model: { status: 'finished', round_number: 1, diff --git a/frontend/tests/vertical-slice.test.ts b/frontend/tests/vertical-slice.test.ts index 81544ee..f1c94f8 100644 --- a/frontend/tests/vertical-slice.test.ts +++ b/frontend/tests/vertical-slice.test.ts @@ -16,6 +16,7 @@ function makeApiMock(overrides?: Partial): ApiClient { session: { code: 'ABCD12', status: 'lobby', host_id: 1, current_round: 1, players_count: 3 }, players: [], round_question: null, + reveal: null, phase_view_model: { status: 'lobby', round_number: 1, @@ -56,7 +57,15 @@ function makeApiMock(overrides?: Partial): ApiClient { session: { code: 'ABCD12', status: 'lie', current_round: 1 }, round: { number: 1, category: { slug: 'history', name: 'History' } } } - }) + }), + showQuestion: vi.fn(), + mixAnswers: vi.fn(), + calculateScores: vi.fn(), + getScoreboard: vi.fn(), + startNextRound: vi.fn(), + finishGame: vi.fn(), + submitLie: vi.fn(), + submitGuess: vi.fn() }; return { ...base, ...overrides };