mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 04:51:25 +00:00
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:
@@ -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,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user