test(mattermost): add sendMedia threadId fallback test

This commit is contained in:
teconomix 2026-03-12 21:03:54 +00:00 committed by Muhammed Mukhthar CM
parent 6c565f88d1
commit 5cc04e2fac
1 changed files with 25 additions and 1 deletions

View File

@ -356,7 +356,7 @@ describe("mattermostPlugin", () => {
);
});
it("uses threadId as fallback when replyToId is absent", async () => {
it("uses threadId as fallback when replyToId is absent (sendText)", async () => {
const sendText = mattermostPlugin.outbound?.sendText;
if (!sendText) {
return;
@ -378,6 +378,30 @@ describe("mattermostPlugin", () => {
}),
);
});
it("uses threadId as fallback when replyToId is absent (sendMedia)", async () => {
const sendMedia = mattermostPlugin.outbound?.sendMedia;
if (!sendMedia) {
return;
}
await sendMedia({
to: "channel:CHAN1",
text: "caption",
mediaUrl: "https://example.com/image.png",
accountId: "default",
threadId: "post-root",
} as any);
expect(sendMessageMattermostMock).toHaveBeenCalledWith(
"channel:CHAN1",
"caption",
expect.objectContaining({
accountId: "default",
replyToId: "post-root",
}),
);
});
});
describe("config", () => {