From b52896d137646c9bf7d34f448fe2e7fb50741f0d Mon Sep 17 00:00:00 2001 From: Asger Geel Weirsoee Date: Sun, 1 Mar 2026 13:17:38 +0000 Subject: [PATCH] test(spa): cover lobby->start-round flow without reload (#169) --- frontend/tests/vertical-slice.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/tests/vertical-slice.test.ts b/frontend/tests/vertical-slice.test.ts index d48904a..fd588b4 100644 --- a/frontend/tests/vertical-slice.test.ts +++ b/frontend/tests/vertical-slice.test.ts @@ -156,4 +156,15 @@ describe('vertical slice controller: lobby -> join -> start round', () => { expect(state.startRoundState).toBe('error'); expect(state.errorMessage).toContain('Kunne ikke starte runden'); }); + + it('uses joined session code when starting round without a reload', async () => { + const api = makeApiMock(); + const controller = createVerticalSliceController(api); + + await controller.joinLobby(' abcd12 ', 'Maja'); + await controller.startRound('', 'history'); + + expect(api.startRound).toHaveBeenCalledWith('ABCD12', { category_slug: 'history' }); + expect(controller.getState().sessionCode).toBe('ABCD12'); + }); });