Skip to content

Commit 6b79e35

Browse files
committed
fix: preserve whatsapp wait compatibility
1 parent b28e44a commit 6b79e35

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

extensions/whatsapp/src/session.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,15 @@ describe("web session", () => {
517517
await expect(promise).resolves.toBeUndefined();
518518
});
519519

520+
it("keeps one-argument callers on the old no-timeout wait policy", async () => {
521+
const ev = new EventEmitter();
522+
const promise = waitForWaConnection({ ev } as unknown as ReturnType<
523+
typeof baileys.makeWASocket
524+
>);
525+
ev.emit("connection.update", { connection: "open" });
526+
await expect(promise).resolves.toBeUndefined();
527+
});
528+
520529
it("rejects when connection closes", async () => {
521530
const ev = new EventEmitter();
522531
const promise = waitForWaConnection(

extensions/whatsapp/src/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export type WhatsAppConnectionWaitOptions =
320320

321321
export async function waitForWaConnection(
322322
sock: ReturnType<typeof makeWASocket>,
323-
options: WhatsAppConnectionWaitOptions,
323+
options: WhatsAppConnectionWaitOptions = { timeout: "none" },
324324
) {
325325
return new Promise<void>((resolve, reject) => {
326326
type OffCapable = {

0 commit comments

Comments
 (0)