Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
test: stabilize cooldown abort coverage case
diegosouzapw08e18867fde3
diff --git a/tests/unit/chat-cooldown-aware-retry.test.ts b/tests/unit/chat-cooldown-aware-retry.test.tsindex 4eda86f660..cf8f1e2d96 100644--- a/tests/unit/chat-cooldown-aware-retry.test.ts+++ b/tests/unit/chat-cooldown-aware-retry.test.ts@@ -284,13 +284,13 @@ test("handleChat returns stream readiness timeout without entering cooldown-awartest("handleChat aborts the pending cooldown wait when the client disconnects", async () => {await seedConnection("openai", {apiKey: "sk-openai-cooldown-abort",- rateLimitedUntil: new Date(Date.now() + 250).toISOString(),+ rateLimitedUntil: new Date(Date.now() + 5_000).toISOString(),lastError: "abort retry wait",errorCode: 429,});await settingsDb.updateSettings({requestRetry: 1,- maxRetryIntervalSec: 1,+ maxRetryIntervalSec: 10,});let fetchCalls = 0;@@ -302,6 +302,7 @@ test("handleChat aborts the pending cooldown wait when the client disconnects",const controller = new AbortController();setTimeout(() => controller.abort(), 40);+ const startedAt = Date.now();const response = await handleChat(buildRequestWithSignal({@@ -312,9 +313,11 @@ test("handleChat aborts the pending cooldown wait when the client disconnects",controller.signal));+ const elapsedMs = Date.now() - startedAt;const body = (await response.json()) as any;assert.equal(fetchCalls, 0);+ assert.ok(elapsedMs < 1_000, `should abort cooldown wait promptly, got ${elapsedMs}ms`);assert.equal(response.status, 499);assert.equal(body.error.message, "Request aborted");});