diff --git a/dashboard/frontend/tests/unit/api.test.js b/dashboard/frontend/tests/unit/api.test.js index 40c3657..bcc5e52 100644 --- a/dashboard/frontend/tests/unit/api.test.js +++ b/dashboard/frontend/tests/unit/api.test.js @@ -277,27 +277,19 @@ describe('API Client - Token Refresh', () => { expect(getToken()).toBe('new-token'); }); - it('should try legacy refresh token if cookie refresh fails', async () => { + it('should return false if cookie refresh fails (no legacy fallback)', async () => { localStorage.getItem.mockReturnValue('legacy-refresh-token'); - // First call (cookie) fails + // Cookie refresh fails global.fetch.mockResolvedValueOnce({ ok: false, status: 401, }); - // Second call (legacy) succeeds - global.fetch.mockResolvedValueOnce({ - ok: true, - status: 200, - json: async () => ({ access_token: 'new-token-from-legacy' }), - }); - const result = await tryRefreshSession(); - expect(result).toBe(true); - expect(getToken()).toBe('new-token-from-legacy'); - expect(localStorage.removeItem).toHaveBeenCalledWith('refresh_token'); + expect(result).toBe(false); + expect(getToken()).toBe(''); }); it('should return false if all refresh attempts fail', async () => {