Files
OmniRoute/tests/unit/qoder-oauth-config.test.ts
backryun 65e0aeda79 [Part 1/3]refactor(qwen): replace legacy Qwen Code and remove OAuth provider (#7866)
* refactor(cli): remove legacy Qwen Code integration

* refactor(qwen): remove deprecated Qwen OAuth provider

* feat(cli): rebuild Qwen Code integration for upstream V4

* fix(qwen): clear stale CLI auth on reset

* test(qwen): align retired provider coverage

* fix(db): renumber qwen-cleanup migration 129 -> 130

release/v3.8.49 tip took slot 129 via #7843 (usage_history_codex_strong_identity,
itself renumbered from 128 during the #7838/#7840 base-red cleanup) after this
branch forked; renumber remove_unregistered_qwen_data to 130.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: Diego Rodrigues de Sa e Souza <8016841+diegosouzapw@users.noreply.github.com>
2026-07-20 17:53:04 -03:00

35 lines
1.5 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
// Gemini / Antigravity / Windsurf public defaults come from
// open-sse/utils/publicCreds.ts — no env setup needed here.
Object.assign(process.env, {
CLAUDE_OAUTH_CLIENT_ID: "9d1c250a-e61b-44d9-88ed-5944d1962f5e",
CODEX_OAUTH_CLIENT_ID: "app_EMoamEEZ73f0CkXaXp7hrann",
KIMI_CODING_OAUTH_CLIENT_ID: "17e5f671-d194-4dfb-9706-5516cb48c098",
GITHUB_OAUTH_CLIENT_ID: "Iv1.b507a08c87ecfe98",
});
const { OAUTH_ENDPOINTS } = await import("../../open-sse/config/constants.ts");
const { qoder } = await import("../../src/lib/oauth/providers/qoder.ts");
const { QODER_CONFIG } = await import("../../src/lib/oauth/constants/oauth.ts");
test("Qoder OAuth defaults no longer point to qoder.cn", () => {
assert.doesNotMatch(QODER_CONFIG.authorizeUrl || "", /qoder\.cn/i);
assert.doesNotMatch(QODER_CONFIG.tokenUrl || "", /qoder\.cn/i);
assert.doesNotMatch(QODER_CONFIG.userInfoUrl || "", /qoder\.cn/i);
assert.doesNotMatch(OAUTH_ENDPOINTS.qoder.auth || "", /qoder\.cn/i);
assert.doesNotMatch(OAUTH_ENDPOINTS.qoder.token || "", /qoder\.cn/i);
});
test("Qoder OAuth provider returns null when browser auth is not configured", () => {
if (!QODER_CONFIG.enabled) {
assert.equal(qoder.buildAuthUrl(QODER_CONFIG, "http://localhost:8080/callback", "state"), null);
return;
}
const authUrl = qoder.buildAuthUrl(QODER_CONFIG, "http://localhost:8080/callback", "state");
assert.equal(typeof authUrl, "string");
assert.doesNotMatch(authUrl || "", /qoder\.cn/i);
});