@@ -197,18 +197,17 @@ test("choosing a directory recovers the session when its location is unavailable
197197 }
198198} )
199199
200- test . each ( [ true , false ] ) ( "choosing the current directory retries without moving (recovered=%s) " , async ( recovered ) => {
200+ test ( "choosing the current directory retries without moving" , async ( ) => {
201201 const fixture = await renderMove ( {
202202 directory : clone ,
203203 unavailable : "location" ,
204204 showMissingLocation : true ,
205- onlyOnError : true ,
206205 } )
207206 try {
208207 fixture . location . set ( { directory : clone } )
209208 await fixture . app . waitFor ( ( ) => fixture . location . error !== undefined )
210209 await fixture . app . waitForFrame ( ( frame ) => frame . includes ( "Session location unavailable" ) )
211- if ( recovered ) fixture . restoreLocation ( )
210+ fixture . restoreLocation ( )
212211
213212 fixture . app . mockInput . pressEnter ( )
214213 await fixture . app . waitForFrame ( ( frame ) => frame . includes ( "Worktrees" ) && frame . includes ( clone ) )
@@ -222,12 +221,6 @@ test.each([true, false])("choosing the current directory retries without moving
222221 expect ( fixture . moves ) . toEqual ( [ ] )
223222 expect ( fixture . route . data ) . toEqual ( { type : "session" , sessionID : "ses_clone" } )
224223 await fixture . app . waitFor ( ( ) => fixture . reads . locations . filter ( ( directory ) => directory === clone ) . length >= 2 )
225- if ( ! recovered ) {
226- await fixture . app . waitFor ( ( ) => fixture . location . error !== undefined )
227- expect ( fixture . location . error ?. location . directory ) . toBe ( clone )
228- await fixture . app . waitForFrame ( ( frame ) => frame . includes ( "Session location unavailable" ) )
229- return
230- }
231224 expect ( fixture . location . error ) . toBeUndefined ( )
232225 await fixture . app . waitFor ( ( ) => fixture . data . location . info ( { directory : clone } ) !== undefined )
233226 const frame = await fixture . app . waitForFrame ( ( frame ) => ! frame . includes ( "Session location unavailable" ) )
@@ -328,10 +321,10 @@ async function renderMove(input: {
328321 launchProjectID ?: string
329322 unavailable ?: "session" | "location"
330323 showMissingLocation ?: boolean
331- onlyOnError ?: boolean
332324 moveFails ?: boolean
333325} ) {
334326 const launch = input . launch ?? ( input . home ? input . directory : main )
327+ let unavailable = input . unavailable
335328 const requests : unknown [ ] = [ ]
336329 const removals : unknown [ ] = [ ]
337330 const moves : unknown [ ] = [ ]
@@ -350,7 +343,7 @@ async function renderMove(input: {
350343 : main ,
351344 }
352345 reads . locations . push ( directory )
353- if ( input . unavailable === "location" && directory === input . directory )
346+ if ( unavailable === "location" && directory === input . directory )
354347 return json ( { message : "Location unavailable" } , { status : 503 } )
355348 return json ( {
356349 directory,
@@ -361,7 +354,7 @@ async function renderMove(input: {
361354 return json ( [ { id : "proj_test" , canonical : main , time : { created : 1 , updated : 1 } , sandboxes : [ ] } ] )
362355 if ( url . pathname === "/api/session/ses_clone" ) {
363356 reads . session ++
364- if ( input . unavailable === "session" ) return json ( { message : "Session unavailable" } , { status : 404 } )
357+ if ( unavailable === "session" ) return json ( { message : "Session unavailable" } , { status : 404 } )
365358 return json ( {
366359 data : {
367360 id : "ses_clone" ,
@@ -422,7 +415,7 @@ async function renderMove(input: {
422415 sessionID : ( ) => ( input . home ? undefined : "ses_clone" ) ,
423416 } )
424417 return input . showMissingLocation ? (
425- < Show when = { ! input . onlyOnError || location . error } >
418+ < Show when = { ! data . location . info ( { directory : input . directory } ) } >
426419 < SessionLocationMissing directory = { input . directory } projectID = "proj_test" sessionID = "ses_clone" />
427420 </ Show >
428421 ) : null
@@ -469,7 +462,7 @@ async function renderMove(input: {
469462 moves,
470463 reads,
471464 restoreLocation ( ) {
472- input . unavailable = undefined
465+ unavailable = undefined
473466 } ,
474467 async create ( ) {
475468 await move . open ( )
0 commit comments