Add WhatsApp reactions support
Summary: Test Plan:
This commit is contained in:
committed by
Peter Steinberger
parent
aa87d6cee8
commit
551a8d5683
@@ -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,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user