fix(slack): apply limit parameter to emoji-list action (#13421)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 67e9b64858
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: steipete <58493+steipete@users.noreply.github.com>
Reviewed-by: @steipete
This commit is contained in:
Marcus Castro
2026-02-13 14:20:41 -03:00
committed by GitHub
parent 86e4fe0a7a
commit 3d921b6157
6 changed files with 71 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
import { describe, expect, it, vi } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../config/config.js";
import { createSlackActions } from "./slack.actions.js";
@@ -9,6 +9,10 @@ vi.mock("../../agents/tools/slack-actions.js", () => ({
}));
describe("slack actions adapter", () => {
beforeEach(() => {
handleSlackAction.mockClear();
});
it("forwards threadId for read", async () => {
const cfg = { channels: { slack: { botToken: "tok" } } } as OpenClawConfig;
const actions = createSlackActions("slack");
@@ -30,4 +34,24 @@ describe("slack actions adapter", () => {
threadId: "171234.567",
});
});
it("forwards normalized limit for emoji-list", async () => {
const cfg = { channels: { slack: { botToken: "tok" } } } as OpenClawConfig;
const actions = createSlackActions("slack");
await actions.handleAction?.({
channel: "slack",
action: "emoji-list",
cfg,
params: {
limit: "2.9",
},
});
const [params] = handleSlackAction.mock.calls[0] ?? [];
expect(params).toMatchObject({
action: "emojiList",
limit: 2,
});
});
});

View File

@@ -210,8 +210,9 @@ export function createSlackActions(providerId: string): ChannelMessageActionAdap
}
if (action === "emoji-list") {
const limit = readNumberParam(params, "limit", { integer: true });
return await handleSlackAction(
{ action: "emojiList", accountId: accountId ?? undefined },
{ action: "emojiList", limit, accountId: accountId ?? undefined },
cfg,
);
}