File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 (
Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ export type WhatsAppConnectionWaitOptions =
320320
321321export 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 = {
You can’t perform that action at this time.
0 commit comments