mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 18:15:23 +00:00
fix(cliproxy): harden quota guards and review follow-ups
This commit is contained in:
1 parent
8c790f41ff
commit
ca58cb5a08
11 files changed
+251
-58
No files matched your search
@@ -377,6 +377,27 @@ describe('Claude Quota Fetcher', () => {
|
||||
expect(fetchMock).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it('treats missing expiry as not expired', async () => {
|
||||
createClaudeAccount('claude-no-expiry@example.com', {
|
||||
access_token: 'no-expiry-token',
|
||||
type: 'claude',
|
||||
});
|
||||
|
||||
global.fetch = mock(() =>
|
||||
Promise.resolve(
|
||||
new Response(JSON.stringify({ restrictions: [] }), {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
)
|
||||
) as typeof fetch;
|
||||
|
||||
const result = await fetchClaudeQuota('claude-no-expiry@example.com');
|
||||
|
||||
expect(result.success).toBe(true);
|
||||
expect(result.windows).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('retries once on transient 500 then succeeds', async () => {
|
||||
createClaudeAccount('claude-retry@example.com', {
|
||||
access_token: 'retry-token',
|
||||
|
||||
Reference in new issue
Block a user