From 41aee75cd1124c088161c3699339fba8a9128513 Mon Sep 17 00:00:00 2001 From: Ayaan Zaidi Date: Thu, 14 May 2026 14:08:59 +0530 Subject: [PATCH] test(cli): prove lazy sender preserves html formatting --- .../channel-outbound-send.test.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/cli/send-runtime/channel-outbound-send.test.ts b/src/cli/send-runtime/channel-outbound-send.test.ts index 7f1e819485f..a729f57dd0e 100644 --- a/src/cli/send-runtime/channel-outbound-send.test.ts +++ b/src/cli/send-runtime/channel-outbound-send.test.ts @@ -89,6 +89,28 @@ describe("createChannelOutboundRuntimeSend", () => { expect(params.accountId).toBe("default"); }); + it("preserves rendered html formatting through lazy text sends", async () => { + const sendText = vi.fn(async () => ({ channel: "telegram", messageId: "tg-1" })); + mocks.loadChannelOutboundAdapter.mockResolvedValue({ + sendText, + }); + + const { createChannelOutboundRuntimeSend } = await import("./channel-outbound-send.js"); + const runtimeSend = createChannelOutboundRuntimeSend({ + channelId: "telegram" as never, + unavailableMessage: "unavailable", + }); + const opts = { + cfg: {}, + textMode: "html" as const, + }; + + await runtimeSend.sendMessage("12345", 'Example', opts); + + const params = expectSingleCallParams(sendText); + expect(params.formatting).toEqual({ parseMode: "HTML" }); + }); + it("routes block sends through payload delivery", async () => { const sendPayload = vi.fn(async () => ({ channel: "slack", messageId: "slack-blocks" })); const sendText = vi.fn();