test: tighten apply patch traversal assertion

This commit is contained in:
Peter Steinberger
2026-05-09 14:33:14 +01:00
parent e84eb59ea2
commit 26816bf852

View File

@@ -218,7 +218,11 @@ describe("Agent-specific tool filtering", () => {
await expect(applyPatchTool.execute("tc1", { input: patch })).rejects.toThrow(
/Path escapes sandbox root/,
);
await expect(fs.readFile(escapedPath, "utf8")).rejects.toMatchObject({ code: "ENOENT" });
const readError = await fs.readFile(escapedPath, "utf8").then(
() => undefined,
(err: NodeJS.ErrnoException) => err,
);
expect(readError?.code).toBe("ENOENT");
});
});