From 0348dd1eab2fe4280929a6e6a9f95cdc8f1f257b Mon Sep 17 00:00:00 2001 From: "Gan, Jimmy" Date: Sat, 11 Jul 2026 04:19:54 +0800 Subject: [PATCH] =?UTF-8?q?S06.7:=20fix=20frontend=20tests=20=E2=80=94=20r?= =?UTF-8?q?emove=20legacy=20refresh=20expectations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dashboard/frontend/tests/unit/api.test.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) 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 () => {