fix(web): improve WhatsApp Web listener errors (#612, thanks @YuriNachos)

This commit is contained in:
Peter Steinberger
2026-01-09 22:40:41 +00:00
parent a9f8719cd2
commit a18743eabc
3 changed files with 26 additions and 18 deletions

View File

@@ -51,6 +51,19 @@ describe("web outbound", () => {
);
});
it("throws a helpful error when no active listener exists", async () => {
setActiveWebListener(null);
await expect(
sendMessageWhatsApp("+1555", "hi", { verbose: false, accountId: "work" }),
).rejects.toThrow(/No active WhatsApp Web listener/);
await expect(
sendMessageWhatsApp("+1555", "hi", { verbose: false, accountId: "work" }),
).rejects.toThrow(/providers login/);
await expect(
sendMessageWhatsApp("+1555", "hi", { verbose: false, accountId: "work" }),
).rejects.toThrow(/account: work/);
});
it("maps audio to PTT with opus mime when ogg", async () => {
const buf = Buffer.from("audio");
loadWebMediaMock.mockResolvedValueOnce({