Add WhatsApp reactions support

Summary:

Test Plan:
This commit is contained in:
Sash Zats
2026-01-06 20:42:05 -05:00
committed by Peter Steinberger
parent aa87d6cee8
commit 551a8d5683
12 changed files with 207 additions and 2 deletions

View File

@@ -8,16 +8,26 @@ vi.mock("./media.js", () => ({
loadWebMedia: (...args: unknown[]) => loadWebMediaMock(...args),
}));
import { sendMessageWhatsApp, sendPollWhatsApp } from "./outbound.js";
import {
sendMessageWhatsApp,
sendPollWhatsApp,
sendReactionWhatsApp,
} from "./outbound.js";
describe("web outbound", () => {
const sendComposingTo = vi.fn(async () => {});
const sendMessage = vi.fn(async () => ({ messageId: "msg123" }));
const sendPoll = vi.fn(async () => ({ messageId: "poll123" }));
const sendReaction = vi.fn(async () => {});
beforeEach(() => {
vi.clearAllMocks();
setActiveWebListener({ sendComposingTo, sendMessage, sendPoll });
setActiveWebListener({
sendComposingTo,
sendMessage,
sendPoll,
sendReaction,
});
});
afterEach(() => {
@@ -156,4 +166,18 @@ describe("web outbound", () => {
durationHours: undefined,
});
});
it("sends reactions via active listener", async () => {
await sendReactionWhatsApp("1555@s.whatsapp.net", "msg123", "✅", {
verbose: false,
fromMe: false,
});
expect(sendReaction).toHaveBeenCalledWith(
"1555@s.whatsapp.net",
"msg123",
"✅",
false,
undefined,
);
});
});