Restore deterministic mediaLocalRoots propagation through extension sendMedia adapters and add coverage for local/remote media handling in Google Chat. Synthesis of #33581, #33545, #33540, #33536, #33528. Co-authored-by: bmendonca3 <bmendonca3@users.noreply.github.com>
35 lines
964 B
TypeScript
35 lines
964 B
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
import { signalPlugin } from "./channel.js";
|
|
|
|
describe("signalPlugin outbound sendMedia", () => {
|
|
it("forwards mediaLocalRoots to sendMessageSignal", async () => {
|
|
const sendSignal = vi.fn(async () => ({ messageId: "m1" }));
|
|
const mediaLocalRoots = ["/tmp/workspace"];
|
|
|
|
const sendMedia = signalPlugin.outbound?.sendMedia;
|
|
if (!sendMedia) {
|
|
throw new Error("signal outbound sendMedia is unavailable");
|
|
}
|
|
|
|
await sendMedia({
|
|
cfg: {} as never,
|
|
to: "signal:+15551234567",
|
|
text: "photo",
|
|
mediaUrl: "/tmp/workspace/photo.png",
|
|
mediaLocalRoots,
|
|
accountId: "default",
|
|
deps: { sendSignal },
|
|
});
|
|
|
|
expect(sendSignal).toHaveBeenCalledWith(
|
|
"signal:+15551234567",
|
|
"photo",
|
|
expect.objectContaining({
|
|
mediaUrl: "/tmp/workspace/photo.png",
|
|
mediaLocalRoots,
|
|
accountId: "default",
|
|
}),
|
|
);
|
|
});
|
|
});
|