test(mcp): align workflow assertions with current guidance

This commit is contained in:
morluto
2026-09-29 13:02:59 +08:00
parent f2dc749c86
commit f8bb113c22
4 changed files with 22 additions and 3 deletions
@@ -61,6 +61,25 @@ it("rejects non-absolute deep-link values", () => {
expect(result.success).toBe(false); expect(result.success).toBe(false);
}); });
it("accepts any argument count while validating each argument", () => {
const input = electronActiveObservationInputSchema.parse({
executable_path: "/opt/electron",
application_path: "/opt/app/main.js",
application_root: "/opt/app",
args: Array.from({ length: 40 }, (_, index) => `--flag-${index}`),
});
expect(input.args).toHaveLength(40);
expect(
electronActiveObservationInputSchema.safeParse({
executable_path: "/opt/electron",
application_path: "/opt/app/main.js",
application_root: "/opt/app",
args: ["x".repeat(4_097)],
}).success,
).toBe(false);
});
it("redacts action inputs from Playwright failures", async () => { it("redacts action inputs from Playwright failures", async () => {
const selector = "#secret-selector"; const selector = "#secret-selector";
const input = electronActiveObservationInputSchema.parse({ const input = electronActiveObservationInputSchema.parse({
@@ -208,7 +208,7 @@ describe("browser scenario MCP tool", () => {
], ],
}, },
capture: { after_each_step: [], at_end: ["url"], events: [] }, capture: { after_each_step: [], at_end: ["url"], events: [] },
limits: { max_duration_ms: 60_000, max_total_metadata_bytes: 4_194_304 }, limits: { max_duration_ms: 60_000 },
}); });
const captured = await client.callTool({ const captured = await client.callTool({
+1 -1
View File
@@ -243,7 +243,7 @@ const assertLiveIdentity = async (client: Client): Promise<void> => {
"For standalone JavaScript or ASAR analysis, use analyze_javascript_application", "For standalone JavaScript or ASAR analysis, use analyze_javascript_application",
); );
expect(instructions).toContain( expect(instructions).toContain(
"For an archive or application package, call open_binary(path), then inspect_artifact", "For an archive or application package, open_binary(path) binds the active target; use inspect_artifact when its graph and findings help",
); );
const identity = await client.callTool({ const identity = await client.callTool({
name: "binary_session", name: "binary_session",
+1 -1
View File
@@ -116,7 +116,7 @@ describe("target-free MCP workflow", () => {
const beforeTools = (await mcp.listTools()).tools; const beforeTools = (await mcp.listTools()).tools;
const beforeNames = beforeTools.map(({ name }) => name); const beforeNames = beforeTools.map(({ name }) => name);
expect(mcp.getInstructions()).toContain( expect(mcp.getInstructions()).toContain(
"For an archive or application package, call open_binary(path), then inspect_artifact", "For an archive or application package, open_binary(path) binds the active target; use inspect_artifact when its graph and findings help",
); );
expect( expect(
beforeTools.find(({ name }) => name === "inspect_artifact")?.description, beforeTools.find(({ name }) => name === "inspect_artifact")?.description,