Files
OmniRoute/tests/unit/reasoning-efforts-override-parser.test.ts
Xiangzhe 9fc3b29217 fix(catalog): scope combo reasoning efforts by connection (#10723)
Merged — locally validated (72/72 focused tests, typecheck:core clean, all static gates green) after resolving base-drift conflicts (catalog.ts cooperative-yield insertion point, modelMetadataRegistry.ts snapshot-param signature). CI's red checks (Unit Tests fast-path shards, Fast Quality Gates, Docs Gates) are confirmed PRE-EXISTING base-red on the pure release tip — reproduced tests/unit/db-driver-bundling-externals.test.ts, tests/unit/model-catalog-runtime-invalidation.test.ts and others failing identically against origin/release/v3.8.50 with zero PR content, unrelated to this change. Thanks for the design and for absorbing #10724's value here — great work on both review rounds!
2026-08-20 09:31:12 -03:00

42 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import test from "node:test";
import assert from "node:assert/strict";
const { parseReasoningEffortsOverride } =
await import("../../src/shared/reasoning/reasoningEffortsOverride.ts");
test("parses native reasoning efforts using only ASCII commas", () => {
assert.deepEqual(parseReasoningEffortsOverride("none, low,medium, high, xhigh,max,ultra"), {
ok: true,
efforts: ["none", "low", "medium", "high", "xhigh", "max", "ultra"],
});
});
test("strips whitespace, CR/LF, NBSP, BOM, and zero-width edge characters", () => {
assert.deepEqual(
parseReasoningEffortsOverride(" low\r\n, max , ultra"),
{ ok: true, efforts: ["low", "max", "ultra"] }
);
});
test("rejects empty, duplicate, unknown, and non-ASCII-comma input", () => {
for (const input of [
"",
"low,",
",low",
"low,,high",
"low, low",
"LOW, low",
"minimal,low",
"low,unknown",
"lowhigh",
"low、high",
]) {
const parsed = parseReasoningEffortsOverride(input);
assert.equal(parsed.ok, false, input);
}
});
test("does not strip invisible characters from the middle of an effort", () => {
assert.equal(parseReasoningEffortsOverride("low,high").ok, false);
});