From a1e78fd52fad81d80814c11b975a1297ff8297cc Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 15 Mar 2026 18:54:19 -0700 Subject: [PATCH] Outbound: test shared interactive telegram delivery --- src/infra/outbound/deliver.test.ts | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/infra/outbound/deliver.test.ts b/src/infra/outbound/deliver.test.ts index cb86483b4b5..075752df083 100644 --- a/src/infra/outbound/deliver.test.ts +++ b/src/infra/outbound/deliver.test.ts @@ -404,6 +404,38 @@ describe("deliverOutboundPayloads", () => { ]); }); + it("renders shared interactive payloads into telegram buttons", async () => { + const sendTelegram = vi.fn().mockResolvedValue({ messageId: "m1", chatId: "c1" }); + + await deliverTelegramPayload({ + sendTelegram, + payload: { + text: "Approval required", + interactive: { + blocks: [ + { + type: "buttons", + buttons: [ + { label: "Allow once", value: "allow-once", style: "success" }, + { label: "Always allow", value: "allow-always", style: "primary" }, + { label: "Deny", value: "deny", style: "danger" }, + ], + }, + ], + }, + }, + }); + + const sendOpts = sendTelegram.mock.calls[0]?.[2] as { buttons?: unknown } | undefined; + expect(sendOpts?.buttons).toEqual([ + [ + { text: "Allow once", callback_data: "allow-once", style: "success" }, + { text: "Always allow", callback_data: "allow-always", style: "primary" }, + { text: "Deny", callback_data: "deny", style: "danger" }, + ], + ]); + }); + it("scopes media local roots to the active agent workspace when agentId is provided", async () => { const sendTelegram = vi.fn().mockResolvedValue({ messageId: "m1", chatId: "c1" });