mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 18:31:10 +00:00
fix(slack): skip monitor startup for disabled accounts [AI-assisted] (openclaw#30592) thanks @liuxiaopai-ai
Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: liuxiaopai-ai <73659136+liuxiaopai-ai@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -6,7 +6,9 @@ import {
|
||||
defaultSlackTestConfig,
|
||||
getSlackTestState,
|
||||
getSlackClient,
|
||||
getSlackHandlers,
|
||||
getSlackHandlerOrThrow,
|
||||
flush,
|
||||
resetSlackTestState,
|
||||
runSlackMessageOnce,
|
||||
startSlackMonitor,
|
||||
@@ -119,6 +121,32 @@ describe("monitorSlackProvider tool results", () => {
|
||||
};
|
||||
}
|
||||
|
||||
it("skips socket startup when Slack channel is disabled", async () => {
|
||||
slackTestState.config = {
|
||||
channels: {
|
||||
slack: {
|
||||
enabled: false,
|
||||
mode: "socket",
|
||||
botToken: "xoxb-config",
|
||||
appToken: "xapp-config",
|
||||
},
|
||||
},
|
||||
};
|
||||
const client = getSlackClient();
|
||||
if (!client) {
|
||||
throw new Error("Slack client not registered");
|
||||
}
|
||||
client.auth.test.mockClear();
|
||||
|
||||
const { controller, run } = startSlackMonitor(monitorSlackProvider);
|
||||
await flush();
|
||||
controller.abort();
|
||||
await run;
|
||||
|
||||
expect(client.auth.test).not.toHaveBeenCalled();
|
||||
expect(getSlackHandlers()?.size ?? 0).toBe(0);
|
||||
});
|
||||
|
||||
it("skips tool summaries with responsePrefix", async () => {
|
||||
replyMock.mockResolvedValue({ text: "final reply" });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user