@@ -213,6 +213,50 @@ describe("deliverReplies", () => {
|
213 | 213 | expect(sendMessage.mock.calls[0]?.[1]).toBe("hello"); |
214 | 214 | }); |
215 | 215 | |
| 216 | +it("renders shared interactive reply buttons as Telegram inline buttons", async () => { |
| 217 | +const runtime = createRuntime(false); |
| 218 | +const sendMessage = vi.fn().mockResolvedValue({ message_id: 2, chat: { id: "123" } }); |
| 219 | +const bot = createBot({ sendMessage }); |
| 220 | + |
| 221 | +await deliverWith({ |
| 222 | +replies: [ |
| 223 | +{ |
| 224 | +text: "Plugin bind approval required", |
| 225 | +interactive: { |
| 226 | +blocks: [ |
| 227 | +{ |
| 228 | +type: "buttons", |
| 229 | +buttons: [ |
| 230 | +{ label: "Allow once", value: "pluginbind:req:o", style: "success" }, |
| 231 | +{ label: "Always allow", value: "pluginbind:req:a", style: "primary" }, |
| 232 | +{ label: "Deny", value: "pluginbind:req:d", style: "danger" }, |
| 233 | +], |
| 234 | +}, |
| 235 | +], |
| 236 | +}, |
| 237 | +}, |
| 238 | +], |
| 239 | + runtime, |
| 240 | + bot, |
| 241 | +}); |
| 242 | + |
| 243 | +expect(sendMessage).toHaveBeenCalledWith( |
| 244 | +"123", |
| 245 | +"Plugin bind approval required", |
| 246 | +expect.objectContaining({ |
| 247 | +reply_markup: { |
| 248 | +inline_keyboard: [ |
| 249 | +[ |
| 250 | +{ text: "Allow once", callback_data: "pluginbind:req:o", style: "success" }, |
| 251 | +{ text: "Always allow", callback_data: "pluginbind:req:a", style: "primary" }, |
| 252 | +{ text: "Deny", callback_data: "pluginbind:req:d", style: "danger" }, |
| 253 | +], |
| 254 | +], |
| 255 | +}, |
| 256 | +}), |
| 257 | +); |
| 258 | +}); |
| 259 | + |
216 | 260 | it("reports message_sent success=false when hooks blank out a text-only reply", async () => { |
217 | 261 | messageHookRunner.hasHooks.mockImplementation( |
218 | 262 | (name: string) => name === "message_sending" || name === "message_sent", |
|