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:
2 files changed
+21
-11
No files matched your search
@@ -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({
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user