Files
ccs/tests/unit/web-server/cliproxy-stats-routes-version-fallback.test.ts
T
Tam Nhu Tran 4e15ec5387 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
2026-04-13 22:19:16 -04:00

47 lines
1.4 KiB
TypeScript

import { describe, expect, it } from 'bun:test';
describe('cliproxy-stats-routes version fallback', () => {
it('returns a degraded update-check payload instead of propagating a 500', async () => {
const { resolveCliproxyUpdateCheckPayload } = await import(
'../../../src/web-server/routes/cliproxy-stats-routes'
);
const body = await resolveCliproxyUpdateCheckPayload('plus', {
checkCliproxyUpdateFn: async () => {
throw new Error('GitHub API error: HTTP 403');
},
getInstalledVersionFn: () => '6.6.80',
});
expect(body).toMatchObject({
hasUpdate: false,
currentVersion: '6.6.80',
latestVersion: '6.6.80',
backend: 'plus',
backendLabel: 'CLIProxy Plus',
fromCache: true,
});
});
it('returns a degraded versions payload instead of propagating a 500', async () => {
const { resolveCliproxyVersionsPayload } = await import(
'../../../src/web-server/routes/cliproxy-stats-routes'
);
const body = await resolveCliproxyVersionsPayload('plus', {
fetchAllVersionsFn: async () => {
throw new Error('GitHub API error: HTTP 403');
},
getInstalledVersionFn: () => '6.6.80',
});
expect(body).toMatchObject({
versions: ['6.6.80'],
latestStable: '6.6.80',
latest: '6.6.80',
currentVersion: '6.6.80',
fromCache: true,
});
});
});