fix(ci): align discord actions contract with config discovery

This commit is contained in:
Peter Steinberger
2026-04-03 13:29:11 +01:00
parent beb108cfaa
commit 65cddd79eb

View File

@@ -176,7 +176,6 @@ function expectClearedSessionBinding(params: {
).toBeNull();
}
const discordDescribeMessageToolMock = vi.fn();
const sendMessageMatrixMock = vi.hoisted(() =>
vi.fn(async (to: string, _message: string, opts?: { threadId?: string }) => ({
messageId: opts?.threadId ? "$matrix-thread" : "$matrix-root",
@@ -184,16 +183,6 @@ const sendMessageMatrixMock = vi.hoisted(() =>
})),
);
setBundledChannelRuntime("discord", {
channel: {
discord: {
messageActions: {
describeMessageTool: discordDescribeMessageToolMock,
},
},
},
} as never);
setBundledChannelRuntime("line", {
channel: {
line: {
@@ -401,17 +390,37 @@ export const actionContractRegistry: ActionsContractEntry[] = [
plugin: requireBundledChannelPlugin("discord"),
cases: [
{
name: "forwards runtime-backed Discord actions and capabilities",
cfg: {} as OpenClawConfig,
expectedActions: ["send", "react", "poll"],
name: "describes configured Discord actions and capabilities",
cfg: {
channels: {
discord: {
token: "Bot token-main",
actions: {
polls: true,
reactions: true,
permissions: false,
messages: false,
pins: false,
threads: false,
search: false,
stickers: false,
memberInfo: false,
roleInfo: false,
emojiUploads: false,
stickerUploads: false,
channelInfo: false,
channels: false,
voiceStatus: false,
events: false,
roles: false,
moderation: false,
presence: false,
},
},
},
} as OpenClawConfig,
expectedActions: ["send", "poll", "react", "reactions", "emoji-list"],
expectedCapabilities: ["interactive", "components"],
beforeTest: () => {
discordDescribeMessageToolMock.mockReset();
discordDescribeMessageToolMock.mockReturnValue({
actions: ["send", "react", "poll"],
capabilities: ["interactive", "components"],
});
},
},
],
},