test: merge signal reaction mapping cases

This commit is contained in:
Peter Steinberger 2026-03-17 09:43:46 +00:00
parent 253ec7452f
commit c4b866855a

View File

@ -1108,6 +1108,18 @@ describe("signalMessageActions", () => {
groupId: "group-id",
targetAuthor: "uuid:123e4567-e89b-12d3-a456-426614174000",
},
toolContext: undefined,
},
{
name: "falls back to toolContext.currentMessageId when messageId is omitted",
cfg: { channels: { signal: { account: "+15550001111" } } } as OpenClawConfig,
accountId: undefined,
params: { to: "+15559999999", emoji: "🔥" },
expectedRecipient: "+15559999999",
expectedTimestamp: 1737630212345,
expectedEmoji: "🔥",
expectedOptions: {},
toolContext: { currentMessageId: "1737630212345" },
},
] as const;
@ -1116,6 +1128,7 @@ describe("signalMessageActions", () => {
await runSignalAction("react", testCase.params, {
cfg: testCase.cfg,
accountId: testCase.accountId,
toolContext: testCase.toolContext,
});
expect(sendReactionSignal, testCase.name).toHaveBeenCalledWith(
testCase.expectedRecipient,
@ -1129,22 +1142,6 @@ describe("signalMessageActions", () => {
}
});
it("falls back to toolContext.currentMessageId for reactions when messageId is omitted", async () => {
sendReactionSignal.mockClear();
await runSignalAction(
"react",
{ to: "+15559999999", emoji: "🔥" },
{ toolContext: { currentMessageId: "1737630212345" } },
);
expect(sendReactionSignal).toHaveBeenCalledTimes(1);
expect(sendReactionSignal).toHaveBeenCalledWith(
"+15559999999",
1737630212345,
"🔥",
expect.objectContaining({}),
);
});
it("rejects invalid signal reaction inputs before dispatch", async () => {
const cfg = {
channels: { signal: { account: "+15550001111" } },