From 6ed8ad184453ee0b4f2a5b9cdb4bbdc2055d7b54 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 15 Mar 2026 18:57:50 -0700 Subject: [PATCH] Discord: test shared interactive renderer --- .../discord/src/shared-interactive.test.ts | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 extensions/discord/src/shared-interactive.test.ts diff --git a/extensions/discord/src/shared-interactive.test.ts b/extensions/discord/src/shared-interactive.test.ts new file mode 100644 index 00000000000..566ec746380 --- /dev/null +++ b/extensions/discord/src/shared-interactive.test.ts @@ -0,0 +1,43 @@ +import { describe, expect, it } from "vitest"; +import { buildDiscordInteractiveComponents } from "./shared-interactive.js"; + +describe("buildDiscordInteractiveComponents", () => { + it("maps shared buttons and selects into Discord component blocks", () => { + expect( + buildDiscordInteractiveComponents({ + blocks: [ + { + type: "buttons", + buttons: [ + { label: "Approve", value: "approve", style: "success" }, + { label: "Reject", value: "reject", style: "danger" }, + ], + }, + { + type: "select", + placeholder: "Pick one", + options: [{ label: "Alpha", value: "alpha" }], + }, + ], + }), + ).toEqual({ + blocks: [ + { + type: "actions", + buttons: [ + { label: "Approve", style: "success", callbackData: "approve" }, + { label: "Reject", style: "danger", callbackData: "reject" }, + ], + }, + { + type: "actions", + select: { + type: "string", + placeholder: "Pick one", + options: [{ label: "Alpha", value: "alpha" }], + }, + }, + ], + }); + }); +});