Files
OmniRoute/tests/unit/web-session-credentials.test.ts
diegosouzapw 75bccccbef chore(release): finalize v3.8.11 changelog + repair release-gate test drift
Finalize the 3.8.11 cycle CHANGELOG and clear the failures the full test:unit
gate surfaced (release-branch drift — PR merges bypassed pre-push):

- CHANGELOG: date the [3.8.11] section (2026-06-05) + repo-housekeeping roll-up
- docs(env): document THEOLDLLM_NAV_TIMEOUT_MS in .env.example + ENVIRONMENT.md
  (env-doc-sync gate; #3217 added the var without docs)
- test(nvidia): exercise the #3226 bypass-fetch path via a local HTTP server and
  hoist the validator import (patching globalThis.fetch no longer intercepts the
  un-patched native fetch captured by proxyFetch)
- test(i18n): import the shipped normalizeComplianceEventTypes helper (#3185)
- test(model-caps): save synced metadata under the canonical gemini-3.1-pro key
  now that #3229 aliases gemini-3.1-pro-high/-low to it
- test(web-session): expect the grok-web "sso + sso-rw" credential hint (#3180)
- test(synced-models): isolate DATA_DIR so the #3199 hidden-override stops
  bleeding into the shared DB and breaking the re-run precondition
2026-06-05 15:38:06 -03:00

52 lines
2.2 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
const providers = await import("../../src/shared/constants/providers.ts");
const webSessionCredentials =
await import("../../src/app/(dashboard)/dashboard/providers/[id]/webSessionCredentials.ts");
test("web session credential metadata covers every web-cookie provider", () => {
for (const providerId of Object.keys(providers.WEB_COOKIE_PROVIDERS)) {
assert.ok(
webSessionCredentials.getWebSessionCredentialRequirement(providerId),
`${providerId} should declare its required web-session credential`
);
}
});
test("web session credential metadata identifies cookie, token, and no-auth providers", () => {
// Grok needs BOTH sso and sso-rw cookies (#3180)
assert.deepEqual(webSessionCredentials.getWebSessionCredentialRequirement("grok-web"), {
kind: "cookie",
credentialName: "sso + sso-rw",
placeholder: "sso=...; sso-rw=...",
acceptsFullCookieHeader: true,
});
assert.deepEqual(webSessionCredentials.getWebSessionCredentialRequirement("copilot-web"), {
kind: "token",
credentialName: "access_token",
placeholder: "access_token=... or a DevTools HAR export",
acceptsFullCookieHeader: false,
});
assert.deepEqual(webSessionCredentials.getWebSessionCredentialRequirement("deepseek-web"), {
kind: "token",
credentialName: "userToken",
placeholder: "userToken=... or paste raw userToken",
acceptsFullCookieHeader: false,
});
// veoaifree-web is now a NOAUTH provider — not in WEB_SESSION_CREDENTIAL_REQUIREMENTS
assert.equal(webSessionCredentials.getWebSessionCredentialRequirement("veoaifree-web"), null);
assert.deepEqual(webSessionCredentials.getWebSessionCredentialRequirement("t3-web"), {
kind: "cookie",
credentialName: "convex-session-id + Cookie header",
placeholder: "convex-session-id=abc123...; Cookie: ...",
acceptsFullCookieHeader: true,
});
});
test("no-auth web providers can be saved without an API key", () => {
assert.equal(providers.providerAllowsOptionalApiKey("veoaifree-web"), true);
assert.equal(webSessionCredentials.requiresWebSessionCredential("veoaifree-web"), false);
assert.equal(webSessionCredentials.requiresWebSessionCredential("chatgpt-web"), true);
});