test(media): verify tmpdir media paths allowed through message action runner

Add integration test confirming that runMessageAction with a sandbox
root now accepts media paths under os.tmpdir() through the full
normalization pipeline (normalizeSandboxMediaList → resolveSandboxedMediaSource).
This commit is contained in:
Alberto Leal
2026-02-16 03:37:28 -05:00
committed by Peter Steinberger
parent 0bb81f7294
commit 8934da785b

View File

@@ -605,6 +605,30 @@ describe("runMessageAction sandboxed media validation", () => {
expect(result.sendResult?.mediaUrl).toBe(path.join(sandboxDir, "data", "note.ogg"));
});
});
it("allows media paths under os.tmpdir()", async () => {
const sandboxDir = await fs.mkdtemp(path.join(os.tmpdir(), "msg-sandbox-"));
try {
const tmpFile = path.join(os.tmpdir(), "test-media-image.png");
const result = await runMessageAction({
cfg: slackConfig,
action: "send",
params: {
channel: "slack",
target: "#C12345678",
media: tmpFile,
message: "",
},
sandboxRoot: sandboxDir,
dryRun: true,
});
expect(result.kind).toBe("send");
expect(result.sendResult?.mediaUrl).toBe(tmpFile);
} finally {
await fs.rm(sandboxDir, { recursive: true, force: true });
}
});
});
describe("runMessageAction media caption behavior", () => {