fix(frontend): restore canonical reveal payload typecheck
This commit is contained in:
@@ -4,10 +4,10 @@ import {
|
|||||||
mapHealthResponse,
|
mapHealthResponse,
|
||||||
mapJoinSessionResponse,
|
mapJoinSessionResponse,
|
||||||
mapMixAnswersResponse,
|
mapMixAnswersResponse,
|
||||||
mapNextRoundResponse,
|
|
||||||
mapScoreboardResponse,
|
mapScoreboardResponse,
|
||||||
mapSessionDetailResponse,
|
mapSessionDetailResponse,
|
||||||
mapShowQuestionResponse,
|
mapShowQuestionResponse,
|
||||||
|
mapStartNextRoundResponse,
|
||||||
mapStartRoundResponse,
|
mapStartRoundResponse,
|
||||||
mapSubmitGuessResponse,
|
mapSubmitGuessResponse,
|
||||||
mapSubmitLieResponse
|
mapSubmitLieResponse
|
||||||
@@ -20,10 +20,10 @@ import type {
|
|||||||
JoinSessionRequest,
|
JoinSessionRequest,
|
||||||
JoinSessionResponse,
|
JoinSessionResponse,
|
||||||
MixAnswersResponse,
|
MixAnswersResponse,
|
||||||
NextRoundResponse,
|
|
||||||
ScoreboardResponse,
|
ScoreboardResponse,
|
||||||
SessionDetailResponse,
|
SessionDetailResponse,
|
||||||
ShowQuestionResponse,
|
ShowQuestionResponse,
|
||||||
|
StartNextRoundResponse,
|
||||||
StartRoundRequest,
|
StartRoundRequest,
|
||||||
StartRoundResponse,
|
StartRoundResponse,
|
||||||
SubmitGuessRequest,
|
SubmitGuessRequest,
|
||||||
@@ -41,7 +41,7 @@ export interface ApiClient {
|
|||||||
mixAnswers(code: string, roundQuestionId: number): Promise<ApiResult<MixAnswersResponse>>;
|
mixAnswers(code: string, roundQuestionId: number): Promise<ApiResult<MixAnswersResponse>>;
|
||||||
calculateScores(code: string, roundQuestionId: number): Promise<ApiResult<CalculateScoresResponse>>;
|
calculateScores(code: string, roundQuestionId: number): Promise<ApiResult<CalculateScoresResponse>>;
|
||||||
getScoreboard(code: string): Promise<ApiResult<ScoreboardResponse>>;
|
getScoreboard(code: string): Promise<ApiResult<ScoreboardResponse>>;
|
||||||
startNextRound(code: string): Promise<ApiResult<NextRoundResponse>>;
|
startNextRound(code: string): Promise<ApiResult<StartNextRoundResponse>>;
|
||||||
finishGame(code: string): Promise<ApiResult<FinishGameResponse>>;
|
finishGame(code: string): Promise<ApiResult<FinishGameResponse>>;
|
||||||
submitLie(code: string, roundQuestionId: number, payload: SubmitLieRequest): Promise<ApiResult<SubmitLieResponse>>;
|
submitLie(code: string, roundQuestionId: number, payload: SubmitLieRequest): Promise<ApiResult<SubmitLieResponse>>;
|
||||||
submitGuess(code: string, roundQuestionId: number, payload: SubmitGuessRequest): Promise<ApiResult<SubmitGuessResponse>>;
|
submitGuess(code: string, roundQuestionId: number, payload: SubmitGuessRequest): Promise<ApiResult<SubmitGuessResponse>>;
|
||||||
@@ -167,10 +167,10 @@ export function createApiClient(baseUrl = '', fetchImpl: typeof fetch = fetch):
|
|||||||
mapScoreboardResponse
|
mapScoreboardResponse
|
||||||
),
|
),
|
||||||
startNextRound: (code: string) =>
|
startNextRound: (code: string) =>
|
||||||
request<NextRoundResponse>(
|
request<StartNextRoundResponse>(
|
||||||
`/lobby/sessions/${encodeURIComponent(normalizeCode(code))}/rounds/next`,
|
`/lobby/sessions/${encodeURIComponent(normalizeCode(code))}/rounds/next`,
|
||||||
'POST',
|
'POST',
|
||||||
mapNextRoundResponse,
|
mapStartNextRoundResponse,
|
||||||
{}
|
{}
|
||||||
),
|
),
|
||||||
finishGame: (code: string) =>
|
finishGame: (code: string) =>
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ describe('gameplay phase machine skeleton', () => {
|
|||||||
session: { code: 'ABCD12', status: 'lie', host_id: 1, current_round: 1, players_count: 3 },
|
session: { code: 'ABCD12', status: 'lie', host_id: 1, current_round: 1, players_count: 3 },
|
||||||
players: [],
|
players: [],
|
||||||
round_question: null,
|
round_question: null,
|
||||||
|
reveal: null,
|
||||||
phase_view_model: {
|
phase_view_model: {
|
||||||
status: 'lie',
|
status: 'lie',
|
||||||
round_number: 1,
|
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 },
|
session: { code: 'ABCD12', status: 'finished', host_id: 1, current_round: 1, players_count: 3 },
|
||||||
players: [],
|
players: [],
|
||||||
round_question: null,
|
round_question: null,
|
||||||
|
reveal: null,
|
||||||
phase_view_model: {
|
phase_view_model: {
|
||||||
status: 'finished',
|
status: 'finished',
|
||||||
round_number: 1,
|
round_number: 1,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ function makeApiMock(overrides?: Partial<ApiClient>): ApiClient {
|
|||||||
session: { code: 'ABCD12', status: 'lobby', host_id: 1, current_round: 1, players_count: 3 },
|
session: { code: 'ABCD12', status: 'lobby', host_id: 1, current_round: 1, players_count: 3 },
|
||||||
players: [],
|
players: [],
|
||||||
round_question: null,
|
round_question: null,
|
||||||
|
reveal: null,
|
||||||
phase_view_model: {
|
phase_view_model: {
|
||||||
status: 'lobby',
|
status: 'lobby',
|
||||||
round_number: 1,
|
round_number: 1,
|
||||||
@@ -56,7 +57,15 @@ function makeApiMock(overrides?: Partial<ApiClient>): ApiClient {
|
|||||||
session: { code: 'ABCD12', status: 'lie', current_round: 1 },
|
session: { code: 'ABCD12', status: 'lie', current_round: 1 },
|
||||||
round: { number: 1, category: { slug: 'history', name: 'History' } }
|
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 };
|
return { ...base, ...overrides };
|
||||||
|
|||||||
Reference in New Issue
Block a user