@@ -298,31 +298,46 @@ describe("session list replacement options", () => {
298298 }
299299 listCallCount += 1 ;
300300 if ( listCallCount === 1 ) {
301- return sessionsResult ( [ { key, kind : "direct" , updatedAt : 10 } ] , listCallCount ) ;
301+ return sessionsResult (
302+ [ { key, kind : "direct" , sessionId : "archived-session" , updatedAt : 10 } ] ,
303+ listCallCount ,
304+ ) ;
302305 }
303306 if ( listCallCount === 2 ) {
307+ return sessionsResult (
308+ [ { key, kind : "direct" , updatedAt : 30 , archived : false } ] ,
309+ listCallCount ,
310+ ) ;
311+ }
312+ if ( listCallCount === 3 ) {
304313 return sessionsResult (
305314 [
306315 {
307316 key,
308317 kind : "direct" ,
309318 sessionId : "replacement-session" ,
310- updatedAt : 30 ,
319+ updatedAt : 40 ,
311320 archived : false ,
312321 } ,
313322 ] ,
314323 listCallCount ,
315324 ) ;
316325 }
317326 return sessionsResult (
318- [ { key, kind : "direct" , updatedAt : 40 , archived : false } ] ,
327+ [ { key, kind : "direct" , updatedAt : 50 , archived : false } ] ,
319328 listCallCount ,
320329 ) ;
321330 } ) ;
322331 const sessions = createSessions ( { request } as unknown as GatewayBrowserClient , key ) ;
323332
324333 await sessions . refresh ( { agentId : "main" , force : true } ) ;
325334 await sessions . patch ( key , { archived : true } , { agentId : "main" } ) ;
335+ expect ( sessions . state . result ?. sessions [ 0 ] ) . toMatchObject ( {
336+ archived : false ,
337+ } ) ;
338+ expect ( sessions . state . result ?. sessions [ 0 ] ?. sessionId ) . toBeUndefined ( ) ;
339+
340+ await sessions . refresh ( { agentId : "main" , force : true } ) ;
326341 expect ( sessions . state . result ?. sessions [ 0 ] ) . toMatchObject ( {
327342 sessionId : "replacement-session" ,
328343 archived : false ,
0 commit comments