S06.7: fix frontend tests — remove legacy refresh expectations
Deploy Dashboard (Main) / Backend Tests (push) Successful in 2m32s
Deploy Dashboard (Main) / Frontend Tests (push) Successful in 6s
Deploy Dashboard (Main) / Build Main Image (push) Successful in 4m11s
Deploy Dashboard (Main) / Deploy to Production (push) Successful in 55s
Deploy Dashboard (Main) / Backend Tests (push) Successful in 2m32s
Deploy Dashboard (Main) / Frontend Tests (push) Successful in 6s
Deploy Dashboard (Main) / Build Main Image (push) Successful in 4m11s
Deploy Dashboard (Main) / Deploy to Production (push) Successful in 55s
This commit is contained in:
@@ -277,27 +277,19 @@ describe('API Client - Token Refresh', () => {
|
|||||||
expect(getToken()).toBe('new-token');
|
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');
|
localStorage.getItem.mockReturnValue('legacy-refresh-token');
|
||||||
|
|
||||||
// First call (cookie) fails
|
// Cookie refresh fails
|
||||||
global.fetch.mockResolvedValueOnce({
|
global.fetch.mockResolvedValueOnce({
|
||||||
ok: false,
|
ok: false,
|
||||||
status: 401,
|
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();
|
const result = await tryRefreshSession();
|
||||||
|
|
||||||
expect(result).toBe(true);
|
expect(result).toBe(false);
|
||||||
expect(getToken()).toBe('new-token-from-legacy');
|
expect(getToken()).toBe('');
|
||||||
expect(localStorage.removeItem).toHaveBeenCalledWith('refresh_token');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return false if all refresh attempts fail', async () => {
|
it('should return false if all refresh attempts fail', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user