mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 15:50:34 +00:00
Harden Telegram poll gating and schema consistency (#36547)
Merged via squash.
Prepared head SHA: f77824419e
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
committed by
GitHub
parent
f771ba8de9
commit
6dfd39c32f
@@ -4,7 +4,11 @@ import type { OpenClawConfig } from "../config/config.js";
|
||||
import { setActivePluginRegistry } from "../plugins/runtime.js";
|
||||
import { defaultRuntime } from "../runtime.js";
|
||||
import { createTestRegistry } from "../test-utils/channel-plugins.js";
|
||||
import { __testing, listAllChannelSupportedActions } from "./channel-tools.js";
|
||||
import {
|
||||
__testing,
|
||||
listAllChannelSupportedActions,
|
||||
listChannelSupportedActions,
|
||||
} from "./channel-tools.js";
|
||||
|
||||
describe("channel tools", () => {
|
||||
const errorSpy = vi.spyOn(defaultRuntime, "error").mockImplementation(() => undefined);
|
||||
@@ -49,4 +53,35 @@ describe("channel tools", () => {
|
||||
expect(listAllChannelSupportedActions({ cfg })).toEqual([]);
|
||||
expect(errorSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("does not infer poll actions from outbound adapters when action discovery omits them", () => {
|
||||
const plugin: ChannelPlugin = {
|
||||
id: "polltest",
|
||||
meta: {
|
||||
id: "polltest",
|
||||
label: "Poll Test",
|
||||
selectionLabel: "Poll Test",
|
||||
docsPath: "/channels/polltest",
|
||||
blurb: "poll plugin",
|
||||
},
|
||||
capabilities: { chatTypes: ["direct"], polls: true },
|
||||
config: {
|
||||
listAccountIds: () => [],
|
||||
resolveAccount: () => ({}),
|
||||
},
|
||||
actions: {
|
||||
listActions: () => [],
|
||||
},
|
||||
outbound: {
|
||||
deliveryMode: "gateway",
|
||||
sendPoll: async () => ({ channel: "polltest", messageId: "poll-1" }),
|
||||
},
|
||||
};
|
||||
|
||||
setActivePluginRegistry(createTestRegistry([{ pluginId: "polltest", source: "test", plugin }]));
|
||||
|
||||
const cfg = {} as OpenClawConfig;
|
||||
expect(listChannelSupportedActions({ cfg, channel: "polltest" })).toEqual([]);
|
||||
expect(listAllChannelSupportedActions({ cfg })).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user