mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 10:43:30 +00:00
* test: focus assertions on behavioral evidence Prune redundant and wording-coupled checks while retaining diagnostic, parser, recovery, and cleanup coverage. * refactor: remove test-only wrappers and duplicate checks Exercise production operations through test fixtures, remove unused adapters, and keep managed-member uncertainty guidance under its existing owner. * test: focus process validation on diagnostic facts * refactor: remove test-only runtime helpers Move semantic evidence fixture setup out of runtime and remove unused Windows settle recovery helpers while checking configured defaults independently. * test: focus artifact diagnostics on format facts * test: verify retained cleanup guidance delivery
46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import { expect, it } from "vitest";
|
|
import { ConfigurationError } from "../domain/configurationErrors.js";
|
|
import {
|
|
DEFAULT_MCP_MAX_INPUT_ELEMENTS,
|
|
parseMcpInputBudget,
|
|
} from "./mcpInputBudget.js";
|
|
|
|
it("defaults to the finite MCP input admission allowance", () => {
|
|
expect(parseMcpInputBudget(undefined)).toEqual({
|
|
ok: true,
|
|
value: DEFAULT_MCP_MAX_INPUT_ELEMENTS,
|
|
});
|
|
});
|
|
|
|
it.each(["1", "8192", "65536", String(Number.MAX_SAFE_INTEGER)])(
|
|
"preserves the selected safe decimal allowance %s",
|
|
(value) => {
|
|
expect(parseMcpInputBudget(value)).toEqual({
|
|
ok: true,
|
|
value: Number(value),
|
|
});
|
|
},
|
|
);
|
|
|
|
it.each([
|
|
"",
|
|
"0",
|
|
"-1",
|
|
"1.5",
|
|
"Infinity",
|
|
"1e5",
|
|
"0x100",
|
|
" 42",
|
|
"9007199254740992",
|
|
])("refuses invalid allowance %s without disabling admission", (value) => {
|
|
const parsed = parseMcpInputBudget(value);
|
|
if (parsed.ok) throw new Error("Invalid admission setting was accepted");
|
|
expect(parsed.error).toBeInstanceOf(ConfigurationError);
|
|
expect(parsed.error.settings).toEqual([
|
|
{
|
|
setting: "REA_MCP_MAX_INPUT_ELEMENTS",
|
|
constraint: expect.stringContaining("positive decimal safe integer"),
|
|
},
|
|
]);
|
|
});
|