@@ -344,35 +344,40 @@ describe("Slack presence monitor", () => {
344344 }
345345 } ) ;
346346
347- it ( "honors Slack Retry-After before resuming presence polling " , async ( ) => {
347+ it ( "honors Slack Retry-After without skipping the unpolled page " , async ( ) => {
348348 let now = 1_000 ;
349349 const getPresence = vi
350350 . fn ( )
351351 . mockRejectedValueOnce ( new WebAPIRateLimitedError ( 120 ) )
352352 . mockResolvedValue ( { presence : "away" } ) ;
353353 const monitor = createSlackPresenceMonitor ( {
354354 accountId : "default" ,
355- accountConfig : { mode : "auto " } ,
355+ accountConfig : { mode : "on " } ,
356356 client : { getPresence } as never ,
357357 cooldownStore : createCooldownStore ( ) ,
358358 enqueue : vi . fn ( ( ) => true ) ,
359359 wake : vi . fn ( ) ,
360360 nowMs : ( ) => now ,
361361 } ) ;
362- monitor . observe ( createPrepared ( { userId : "U1" } ) ) ;
363- monitor . observe ( createPrepared ( { userId : "U2" } ) ) ;
362+ for ( let index = 1 ; index <= 46 ; index += 1 ) {
363+ monitor . observe ( createPrepared ( { userId : `U${ String ( index ) . padStart ( 4 , "0" ) } ` } ) ) ;
364+ }
364365
365366 await monitor . pollOnce ( ) ;
366- expect ( getPresence ) . toHaveBeenCalledExactlyOnceWith ( { user : "U1 " } ) ;
367+ expect ( getPresence ) . toHaveBeenCalledExactlyOnceWith ( { user : "U0001 " } ) ;
367368
368369 now += 119_999 ;
369370 await monitor . pollOnce ( ) ;
370371 expect ( getPresence ) . toHaveBeenCalledTimes ( 1 ) ;
371372
372373 now += 1 ;
373374 await monitor . pollOnce ( ) ;
374- expect ( getPresence ) . toHaveBeenNthCalledWith ( 2 , { user : "U1" } ) ;
375- expect ( getPresence ) . toHaveBeenNthCalledWith ( 3 , { user : "U2" } ) ;
375+ expect ( getPresence ) . toHaveBeenNthCalledWith ( 2 , { user : "U0001" } ) ;
376+ expect ( getPresence ) . toHaveBeenNthCalledWith ( 3 , { user : "U0002" } ) ;
377+ expect ( getPresence ) . toHaveBeenCalledTimes ( 46 ) ;
378+
379+ await monitor . pollOnce ( ) ;
380+ expect ( getPresence ) . toHaveBeenNthCalledWith ( 47 , { user : "U0046" } ) ;
376381 } ) ;
377382
378383 it ( "bounds stop while a presence request is stalled" , async ( ) => {
0 commit comments