@@ -51,7 +51,8 @@ beforeEach(() => {
5151 vi . useFakeTimers ( )
5252 toastShow . mockReset ( )
5353 // clear any leftover processes between tests
54- for ( const pid of [ 'p1' , 'p2' , 'bulk' ] ) queueStore . dismiss ( pid )
54+ for ( const pid of [ 'p1' , 'p2' , 'bulk' , 'hints-auto-1' , 'hints-1' , 'hints-2' , 'hints-bg-1' , 'hints-bg-2' ] )
55+ queueStore . dismiss ( pid )
5556} )
5657
5758afterEach ( ( ) => {
@@ -386,6 +387,33 @@ describe('queueStore.attachPhaseHints', () => {
386387 expect ( queueStore . getPhaseHints ( pid ) ) . toBeUndefined ( )
387388 } )
388389
390+ it ( 'clears hints after auto-dismiss when undo window elapses' , async ( ) => {
391+ const pid = 'hints-auto-1'
392+ dispatch ( { total : 1 , completed : 0 , paused : false , processId : pid , label : 'A' } )
393+ queueStore . attachPhaseHints ( pid , {
394+ reverse : {
395+ messageType : 'bulkUpdate' ,
396+ data : { reopen : true } ,
397+ affectedItemIds : [ 'i1' ] ,
398+ } ,
399+ } )
400+ dispatch ( { total : 0 , completed : 0 , paused : false , status : 'Done!' , processId : pid } )
401+
402+ await vi . advanceTimersByTimeAsync ( 10_500 )
403+
404+ expect ( queueStore . getPhaseHints ( pid ) ) . toBeUndefined ( )
405+
406+ dispatch ( { total : 2 , completed : 0 , paused : false , processId : pid , label : 'Second run' } )
407+
408+ const snapshots : any [ ] [ ] = [ ]
409+ const unsub = queueStore . subscribe ( ( e ) => snapshots . push ( [ ...e ] ) )
410+ const entry = snapshots [ snapshots . length - 1 ] . find ( ( p : any ) => p . processId === pid )
411+ expect ( entry . phase . kind ) . toBe ( 'in-flight' )
412+ expect ( entry . phase . reverse ) . toBeUndefined ( )
413+ expect ( entry . phase . undoableUntil ) . toBeUndefined ( )
414+ unsub ( )
415+ } )
416+
389417 it ( '§4.9 — consumes reverse hint piggy-backed on Done broadcast and exposes Undo' , ( ) => {
390418 const pid = 'hints-bg-1'
391419 const snapshots : any [ ] [ ] = [ ]
0 commit comments