fix(cron): require explicit poll delivery targets · openclaw/openclaw@b3128ba
vincentkoc
·
2026-06-16
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1258,6 +1258,35 @@ describe("message tool explicit target guard", () => {
|
1258 | 1258 | expect(mocks.runMessageAction).not.toHaveBeenCalled(); |
1259 | 1259 | }); |
1260 | 1260 | |
| 1261 | +it.each([ |
| 1262 | +{ |
| 1263 | +action: "poll", |
| 1264 | +params: { |
| 1265 | +action: "poll", |
| 1266 | +pollQuestion: "Lunch?", |
| 1267 | +pollOption: ["Pizza", "Sushi"], |
| 1268 | +}, |
| 1269 | +}, |
| 1270 | +{ |
| 1271 | +action: "sticker", |
| 1272 | +params: { |
| 1273 | +action: "sticker", |
| 1274 | +stickerId: "sticker-1", |
| 1275 | +}, |
| 1276 | +}, |
| 1277 | +] as const)("requires an explicit target for $action when configured", async ({ params }) => { |
| 1278 | +const tool = createMessageTool({ |
| 1279 | +runMessageAction: mocks.runMessageAction as never, |
| 1280 | +requireExplicitTarget: true, |
| 1281 | +currentChannelProvider: "slack", |
| 1282 | +currentChannelId: "channel:C123", |
| 1283 | +}); |
| 1284 | + |
| 1285 | +await expect(tool.execute("1", params)).rejects.toThrow(/Explicit message target required/i); |
| 1286 | + |
| 1287 | +expect(mocks.runMessageAction).not.toHaveBeenCalled(); |
| 1288 | +}); |
| 1289 | + |
1261 | 1290 | it("allows upload-file when an explicit target is provided", async () => { |
1262 | 1291 | mocks.runMessageAction.mockResolvedValueOnce({ |
1263 | 1292 | kind: "action", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。