mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 18:52:48 +00:00
test(pcap): verify relative tool diagnostics through MCP
Refs #7569 Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
1 parent
1327c386da
commit
90fd58d373
1 file changed
+21
-4
@@ -1,6 +1,7 @@
|
||||
import { expect } from "vitest";
|
||||
|
||||
import { cliTest } from "../../support/cli/cliFixture.js";
|
||||
import { connectLocalToolsMcp } from "../../fixtures/localToolsMcp.js";
|
||||
|
||||
cliTest.for([
|
||||
{ setting: "REA_TSHARK_COMMAND", value: "rel/tshark" },
|
||||
@@ -8,17 +9,33 @@ cliTest.for([
|
||||
] as const)(
|
||||
"Wireshark refuses and identifies the caller's relative $setting selection",
|
||||
async ({ setting, value }, { cli }) => {
|
||||
const environment = {
|
||||
REA_TSHARK_COMMAND: "/nonexistent/rea-test-tshark",
|
||||
[setting]: value,
|
||||
};
|
||||
const result = await cli.run({
|
||||
arguments: ["inspect-pcap-client", "--format", "json"],
|
||||
environment: {
|
||||
REA_TSHARK_COMMAND: "/nonexistent/rea-test-tshark",
|
||||
[setting]: value,
|
||||
},
|
||||
environment,
|
||||
timeoutMs: 10_000,
|
||||
});
|
||||
expect(result.exitCode, result.stderr).toBe(1);
|
||||
expect(result.stdout).toContain(setting);
|
||||
expect(result.stdout).toContain(value);
|
||||
expect(result.stdout).toContain("absolute path");
|
||||
expect(result.json).toMatchObject({
|
||||
code: "capability_unavailable",
|
||||
retryable: false,
|
||||
details: { diagnostics: { configured: value } },
|
||||
});
|
||||
const { client, call } = await connectLocalToolsMcp(environment);
|
||||
try {
|
||||
const reply = await call("inspect_pcap_client", {});
|
||||
expect(reply.isError).toBe(true);
|
||||
const content = reply.content.find((item) => item.type === "text");
|
||||
if (content?.type !== "text") throw new Error("Missing MCP error text");
|
||||
expect(JSON.parse(content.text)).toEqual({ error: result.json });
|
||||
} finally {
|
||||
await client.close();
|
||||
}
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user