mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 16:17:02 +00:00
fix(cliproxy): degrade gracefully on GitHub release 403s
- fall back to stale CLIProxy version caches instead of surfacing 500s - remove duplicate dashboard update-check fetches and disable retry/focus refetch - add backend and UI regressions for the degraded-path behavior
This commit is contained in:
1 parent
4874c154cb
commit
4e15ec5387
8 files changed
+418
-86
No files matched your search
@@ -0,0 +1,56 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { render, screen } from '../../../setup/test-utils';
|
||||
|
||||
const hookMocks = vi.hoisted(() => ({
|
||||
startAuth: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@/hooks/use-cliproxy', () => ({
|
||||
useCliproxyAuth: () => ({
|
||||
data: {
|
||||
authStatus: [],
|
||||
},
|
||||
}),
|
||||
useCliproxyUpdateCheck: () => ({
|
||||
data: {
|
||||
backendLabel: 'CLIProxy Plus',
|
||||
currentVersion: '6.9.23-0',
|
||||
isStable: true,
|
||||
stabilityMessage: undefined,
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@/hooks/use-cliproxy-auth-flow', () => ({
|
||||
useCliproxyAuthFlow: () => ({
|
||||
provider: null,
|
||||
isAuthenticating: false,
|
||||
startAuth: hookMocks.startAuth,
|
||||
}),
|
||||
}));
|
||||
|
||||
import { CliproxyHeader } from '@/components/cliproxy/cliproxy-header';
|
||||
|
||||
describe('CliproxyHeader', () => {
|
||||
const fetchMock = vi.fn<typeof fetch>();
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
fetchMock.mockReset();
|
||||
vi.stubGlobal('fetch', fetchMock);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
|
||||
it('renders version data from the shared update query without issuing a direct fetch', () => {
|
||||
render(
|
||||
<CliproxyHeader onRefresh={vi.fn()} isRefreshing={false} lastUpdated={new Date()} isRunning />
|
||||
);
|
||||
|
||||
expect(screen.getByText('CLIProxy Plus')).toBeInTheDocument();
|
||||
expect(screen.getByText('v6.9.23-0')).toBeInTheDocument();
|
||||
expect(fetchMock).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user