mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 20:00:42 +00:00
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:
committed by
Peter Steinberger
parent
0bb81f7294
commit
8934da785b
@@ -605,6 +605,30 @@ describe("runMessageAction sandboxed media validation", () => {
|
|||||||
expect(result.sendResult?.mediaUrl).toBe(path.join(sandboxDir, "data", "note.ogg"));
|
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", () => {
|
describe("runMessageAction media caption behavior", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user