@@ -488,6 +488,37 @@ describe("Android delivery routing", () => {
488488 ) ,
489489 ) ;
490490
491+ it . effect ( "an unchanged refresh preserves old attention exclusions after the job lifetime" , ( ) =>
492+ withRegisteredDevice ( ( { h, register, target } ) =>
493+ Effect . gen ( function * ( ) {
494+ const delivery = yield * FcmDeliveries . FcmDeliveries ;
495+ const other = { ...secondState , environmentId : EnvironmentId . make ( "other-env" ) } ;
496+ h . current . otherStates = [ other ] ;
497+ yield * register ( preferences ) ;
498+ yield * delivery . process ( { ...h . job , state : null , replay : true } ) ;
499+ yield * TestClock . adjust ( "1 second" ) ;
500+ yield * register ( { ...preferences , disabledEnvironmentIds : [ other . environmentId ] } ) ;
501+ h . current . otherStates = [ { ...other , phase : "waiting_for_approval" } ] ;
502+ yield * delivery . process ( { ...h . job , state : null , replay : true } ) ;
503+ yield * TestClock . adjust ( "1 second" ) ;
504+ yield * register ( preferences ) ;
505+ yield * TestClock . adjust ( "6 minutes" ) ;
506+ yield * register ( preferences ) ;
507+ h . current . state = {
508+ ...state ,
509+ phase : "waiting_for_input" ,
510+ updatedAt : DateTime . formatIso ( yield * DateTime . now ) ,
511+ } ;
512+ yield * delivery . enqueue ( { target : yield * target , state : h . current . state } ) ;
513+ yield * delivery . process ( h . queued [ 0 ] ) ;
514+ expect ( h . sent . filter ( ( message ) => message . alert ) . map ( ( message ) => message . data ) ) . toEqual ( [
515+ expect . objectContaining ( { alert_title : state . threadTitle } ) ,
516+ ] ) ;
517+ expect ( h . marked . at ( - 1 ) ?. aggregate ?. activities ) . toHaveLength ( 2 ) ;
518+ } ) ,
519+ ) ,
520+ ) ;
521+
491522 const cardsOff = { name : "with activity cards off" , cards : false , notificationOnly : false } ;
492523 const notificationOnly = {
493524 name : "for a notification-only environment" ,
0 commit comments