mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 12:41:12 +00:00
Discord: test shared interactive renderer
This commit is contained in:
43
extensions/discord/src/shared-interactive.test.ts
Normal file
43
extensions/discord/src/shared-interactive.test.ts
Normal file
@@ -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" }],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user