mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
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
50 lines
1.9 KiB
TypeScript
50 lines
1.9 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
// The shipped helper is `normalizeComplianceEventTypes` (#3185); it nests dotted
|
|
// keys under `compliance.eventTypes` and is a no-op for messages without that path.
|
|
import { normalizeComplianceEventTypes as nestDottedKeys } from "@/i18n/request";
|
|
|
|
test("nestDottedKeys expands flat compliance.eventTypes keys into nested objects", () => {
|
|
const input = {
|
|
compliance: {
|
|
eventTypes: {
|
|
"apiKey.activate": "API Key Activated",
|
|
"apiKey.scopes.grant": "API Key Scopes Granted",
|
|
"apiKey.scopes.revoke": "API Key Scopes Revoked",
|
|
"auth.login.success": "Login Successful",
|
|
},
|
|
},
|
|
};
|
|
|
|
const out = nestDottedKeys(input) as any;
|
|
assert.equal(out.compliance.eventTypes.apiKey.activate, "API Key Activated");
|
|
assert.equal(out.compliance.eventTypes.apiKey.scopes.grant, "API Key Scopes Granted");
|
|
assert.equal(out.compliance.eventTypes.apiKey.scopes.revoke, "API Key Scopes Revoke".concat("d"));
|
|
assert.equal(out.compliance.eventTypes.auth.login.success, "Login Successful");
|
|
// No dotted key survives.
|
|
assert.equal(
|
|
JSON.stringify(out).includes('"apiKey.activate"'),
|
|
false,
|
|
"dotted keys must be gone"
|
|
);
|
|
});
|
|
|
|
test("nestDottedKeys leaves plain nested messages untouched and preserves values with dots", () => {
|
|
const input = {
|
|
providers: { add: "Add", hint: "Use gpt-4.1 here" },
|
|
list: ["a.b", "c"],
|
|
};
|
|
const out = nestDottedKeys(input) as any;
|
|
assert.equal(out.providers.add, "Add");
|
|
// A "." in a VALUE must be preserved (only KEYS are nested).
|
|
assert.equal(out.providers.hint, "Use gpt-4.1 here");
|
|
assert.deepEqual(out.list, ["a.b", "c"]);
|
|
});
|
|
|
|
test("nestDottedKeys ignores prototype-pollution segments", () => {
|
|
const out = nestDottedKeys({ "__proto__.polluted": "x", safe: "y" }) as any;
|
|
assert.equal(out.safe, "y");
|
|
assert.equal(({} as any).polluted, undefined);
|
|
});
|