feat(i18n): share lobby message catalog across frontend/backend
All checks were successful
CI / test-and-quality (pull_request) Successful in 2m8s
CI / test-and-quality (push) Successful in 2m15s

This commit is contained in:
2026-03-01 15:07:34 +00:00
committed by Asger Geel Weirsoee
parent a5c9e4f255
commit 3253f4d343
8 changed files with 166 additions and 26 deletions

View File

@@ -161,7 +161,7 @@ describe('vertical slice controller: lobby -> join -> start round', () => {
joinSession: vi.fn().mockResolvedValue({
ok: false,
status: 404,
error: { kind: 'http', status: 404, message: 'HTTP 404', payload: { error: 'Session not found' } }
error: { kind: 'http', status: 404, message: 'HTTP 404', payload: { error: 'Session not found', error_code: 'session_not_found' } }
})
});
@@ -170,7 +170,7 @@ describe('vertical slice controller: lobby -> join -> start round', () => {
const state = controller.getState();
expect(state.joinState).toBe('error');
expect(state.errorMessage).toContain('Join fejlede');
expect(state.errorMessage).toBe('Session code is invalid or the session no longer exists.');
});
it('surfaces a friendly error when round start fails', async () => {
@@ -178,7 +178,7 @@ describe('vertical slice controller: lobby -> join -> start round', () => {
startRound: vi.fn().mockResolvedValue({
ok: false,
status: 400,
error: { kind: 'http', status: 400, message: 'HTTP 400', payload: { error: 'Round can only be started from lobby' } }
error: { kind: 'http', status: 400, message: 'HTTP 400', payload: { error: 'Round can only be started from lobby', error_code: 'round_start_invalid_phase' } }
})
});
@@ -187,7 +187,7 @@ describe('vertical slice controller: lobby -> join -> start round', () => {
const state = controller.getState();
expect(state.startRoundState).toBe('error');
expect(state.errorMessage).toContain('Kunne ikke starte runden');
expect(state.errorMessage).toBe('Could not start round. Refresh the lobby and try again.');
});
it('shows local validation error and avoids API call when hydrating without any session code', async () => {
@@ -197,7 +197,7 @@ describe('vertical slice controller: lobby -> join -> start round', () => {
await controller.hydrateLobby(' ');
const state = controller.getState();
expect(state.errorMessage).toBe('Session-kode mangler.');
expect(state.errorMessage).toBe('Session code is required.');
expect(state.loadingSession).toBe(false);
expect(api.getSession).not.toHaveBeenCalled();
});
@@ -210,7 +210,7 @@ describe('vertical slice controller: lobby -> join -> start round', () => {
const state = controller.getState();
expect(state.startRoundState).toBe('error');
expect(state.errorMessage).toBe('Session-kode mangler.');
expect(state.errorMessage).toBe('Session code is required.');
expect(api.startRound).not.toHaveBeenCalled();
});