test(mcp): assert bundle path issues by field

compare_bundles reports each relative path as an invalid_format issue
instead of one joined diagnostic sentence.
This commit is contained in:
Cursor Agent committed 2026-10-29 09:04:38 +00:00
1 parent 4a6ee110a9
commit 499adf993b
2 files changed
+21 -11

No files matched your search

+10 -6
View File
@@ -12,6 +12,7 @@ import {
createEvidenceBundle,
serializeEvidenceBundle,
} from "../../../src/domain/evidenceBundle.js";
import { parseMcpToolError } from "../../fixtures/mcpToolError.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
import { cliTest } from "../../support/cli/cliFixture.js";
@@ -219,12 +220,15 @@ cliTest(
name: "compare_bundles",
arguments: { left_bundle_path: left, right_bundle_path: right },
});
expect(result.isError).toBe(true);
expect(result.content[0]).toMatchObject({
text: expect.stringContaining(
`${rejectedField}: must be an absolute local filesystem path`,
),
});
expect(parseMcpToolError(result).error.details?.issues).toEqual(
expect.arrayContaining([
expect.objectContaining({
path: [rejectedField],
reason: "invalid_format",
message: "must be an absolute local filesystem path",
}),
]),
);
}
const absolute = await client.callTool({
+11 -5
View File
@@ -164,11 +164,17 @@ it("requires absolute bundle paths without changing server-cwd semantics", async
expect(parseMcpToolError(result).error).toMatchObject({
code: "invalid_request",
category: "invalid_input",
});
expect(result.content[0]).toMatchObject({
text: expect.stringContaining(
`${rejectedField}: must be an absolute local filesystem path`,
),
details: {
operation: "compare_bundles",
issues: expect.arrayContaining([
{
path: [rejectedField],
reason: "invalid_format",
expected: "regex",
message: "must be an absolute local filesystem path",
},
]),
},
});
}
expect(