Reply: update shared interactive normalize tests

This commit is contained in:
Vincent Koc 2026-03-15 18:53:04 -07:00 committed by Peter Steinberger
parent 576ea84195
commit 8f41001edf

View File

@ -158,10 +158,10 @@ describe("normalizeReplyPayload", () => {
expect(result).not.toBeNull(); expect(result).not.toBeNull();
expect(result!.text).toBe("hello [[slack_buttons: Retry:retry, Ignore:ignore]]"); expect(result!.text).toBe("hello [[slack_buttons: Retry:retry, Ignore:ignore]]");
expect(result!.channelData).toBeUndefined(); expect(result!.interactive).toBeUndefined();
}); });
it("applies responsePrefix before compiling Slack directives into blocks", () => { it("applies responsePrefix before compiling Slack directives into shared interactive blocks", () => {
const result = normalizeReplyPayload( const result = normalizeReplyPayload(
{ {
text: "hello [[slack_buttons: Retry:retry, Ignore:ignore]]", text: "hello [[slack_buttons: Retry:retry, Ignore:ignore]]",
@ -171,44 +171,26 @@ describe("normalizeReplyPayload", () => {
expect(result).not.toBeNull(); expect(result).not.toBeNull();
expect(result!.text).toBe("[bot] hello"); expect(result!.text).toBe("[bot] hello");
expect(result!.channelData).toEqual({ expect(result!.interactive).toEqual({
slack: { blocks: [
blocks: [ {
{ type: "text",
type: "section", text: "[bot] hello",
text: { },
type: "mrkdwn", {
text: "[bot] hello", type: "buttons",
buttons: [
{
label: "Retry",
value: "retry",
}, },
}, {
{ label: "Ignore",
type: "actions", value: "ignore",
block_id: "openclaw_reply_buttons_1", },
elements: [ ],
{ },
type: "button", ],
action_id: "openclaw:reply_button",
text: {
type: "plain_text",
text: "Retry",
emoji: true,
},
value: "reply_1_retry",
},
{
type: "button",
action_id: "openclaw:reply_button",
text: {
type: "plain_text",
text: "Ignore",
emoji: true,
},
value: "reply_2_ignore",
},
],
},
],
},
}); });
}); });
}); });