mirror of
https://github.com/morluto/rea.git
synced 2026-11-12 09:52:27 +00:00
test: focus diagnostics and evidence checks on behavior (#9303)
* test: focus configuration diagnostics on their owners Preserve shape errors, selected paths, recovery guidance, and unchanged-file behavior across parser, setup, and uninstall boundaries. * test: focus artifact and evidence checks on behavior Retain format, identity, malformed-input, and cleanup coverage while removing fixed prose and closing the admitted test source. * refactor(debugger): use configured session admission limits * test: focus evidence and diagnostics on behavior * fix(test): restore verifier export and formatting * test(config): verify debugger limit ranges * test(rizin): keep fixture executable authoritative * test(rizin): isolate debugger fixture environment
This commit is contained in:
1 parent
08637b0c24
commit
5044e20171
290 files changed
+2808
-2030
No files matched your search
@@ -1,34 +1,32 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
ClientConfigurationShapeError,
|
||||
parseClientConfiguration,
|
||||
shadowedClientServers,
|
||||
} from "./ClientConfigurationDocument.js";
|
||||
|
||||
describe("parseClientConfiguration shape diagnostics", () => {
|
||||
it.each([
|
||||
["null", "null"],
|
||||
["array", "[]"],
|
||||
["string", '"x"'],
|
||||
] as const)("names a non-object JSON root (%s)", (_label, text) => {
|
||||
expect(() => parseClientConfiguration(text, "json")).toThrow(
|
||||
new TypeError("The configuration root must be an object"),
|
||||
);
|
||||
["null root", "null", "root"],
|
||||
["array root", "[]", "root"],
|
||||
["string root", '"x"', "root"],
|
||||
["null server table", '{"mcpServers":null,"keep":1}', "mcpServers"],
|
||||
["array server table", '{"mcpServers":[],"keep":1}', "mcpServers"],
|
||||
["string server table", '{"mcpServers":"x","keep":1}', "mcpServers"],
|
||||
])("reports a non-object %s", (_label, text, location) => {
|
||||
let error: unknown;
|
||||
try {
|
||||
parseClientConfiguration(text, "json");
|
||||
} catch (cause: unknown) {
|
||||
error = cause;
|
||||
}
|
||||
expect(error).toBeInstanceOf(ClientConfigurationShapeError);
|
||||
if (!(error instanceof Error)) throw new Error("Expected shape error");
|
||||
expect(error.message).toContain(location);
|
||||
expect(error.message).toContain("object");
|
||||
});
|
||||
|
||||
it.each([
|
||||
["null", "null"],
|
||||
["array", "[]"],
|
||||
["string", '"x"'],
|
||||
] as const)(
|
||||
'names a non-object "mcpServers" value (%s)',
|
||||
(_label, servers) => {
|
||||
expect(() =>
|
||||
parseClientConfiguration(`{"mcpServers":${servers},"keep":1}`, "json"),
|
||||
).toThrow(new TypeError('"mcpServers" must be an object'));
|
||||
},
|
||||
);
|
||||
|
||||
it("still rejects unparsable JSON with SyntaxError", () => {
|
||||
expect(() => parseClientConfiguration("not-json", "json")).toThrow(
|
||||
SyntaxError,
|
||||
|
||||
Reference in new issue
Block a user