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'); + }); });