Skip to content

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

test(auth): cover stale active error metadata path

Kfir Amar9806648c07a7
diff --git a/tests/unit/auth-clear-account-error.test.mjs b/tests/unit/auth-clear-account-error.test.mjs
index cab519edff..cb7f283f7f 100644
--- a/tests/unit/auth-clear-account-error.test.mjs
+++ b/tests/unit/auth-clear-account-error.test.mjs
@@ -32,16 +32,20 @@ test("clearAccountError clears stale provider error metadata after recovery", as
accessToken: "access",
refreshToken: "refresh",
- testStatus: "error",
- lastError: "Health check: token refresh failed",
+ testStatus: "active",
+ lastError: null,
lastErrorType: "token_refresh_failed",
lastErrorSource: "oauth",
errorCode: "refresh_failed",
- rateLimitedUntil: new Date(Date.now() + 60_000).toISOString(),
+ rateLimitedUntil: null,
backoffLevel: 2,
});
const credentials = await auth.getProviderCredentials("codex");
+ assert.equal(credentials.connectionId, created.id);
+ assert.equal(credentials.errorCode, "refresh_failed");
+ assert.equal(credentials.lastErrorType, "token_refresh_failed");
+ assert.equal(credentials.lastErrorSource, "oauth");
await auth.clearAccountError(created.id, credentials);
const updated = await providersDb.getProviderConnectionById(created.id);