feat(i18n): share lobby message catalog across frontend/backend
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user