@@ -66,7 +66,12 @@ describe("reopenClosedView", () => {
6666 it ( "restores saved file and pull request tabs without creating resources" , async ( ) => {
6767 const openPreview = vi . fn ( ) ;
6868 const openTerminal = vi . fn ( ) ;
69- const options = { openPreview, openTerminal, closeTerminal : vi . fn ( ) , workspace : null } ;
69+ const options = {
70+ openPreview,
71+ openTerminal,
72+ closeTerminal : vi . fn ( ) ,
73+ workspace : { cwd : "/repo" } ,
74+ } ;
7075 expect (
7176 await reopenClosedView (
7277 {
@@ -106,6 +111,32 @@ describe("reopenClosedView", () => {
106111 expect ( openTerminal ) . not . toHaveBeenCalled ( ) ;
107112 } ) ;
108113
114+ it ( "does not reopen workspace tabs without an available project" , async ( ) => {
115+ const options = {
116+ openPreview : vi . fn ( ) ,
117+ openTerminal : vi . fn ( ) ,
118+ closeTerminal : vi . fn ( ) ,
119+ workspace : null ,
120+ } ;
121+ for ( const surface of [
122+ { kind : "files" , id : "files" } ,
123+ {
124+ kind : "file" ,
125+ id : "file:src/app.ts" ,
126+ relativePath : "src/app.ts" ,
127+ revealLine : null ,
128+ revealRequestId : 0 ,
129+ } ,
130+ ] as const ) {
131+ expect ( await reopenClosedView ( { kind : "panel-tab" , threadRef, surface } , options ) ) . toBe (
132+ false ,
133+ ) ;
134+ }
135+ expect (
136+ selectThreadRightPanelState ( useRightPanelStore . getState ( ) . byThreadKey , threadRef ) . surfaces ,
137+ ) . toEqual ( [ ] ) ;
138+ } ) ;
139+
109140 it ( "recreates a browser tab with saved URL, viewport and profile, then selects its new ID" , async ( ) => {
110141 const openPreview = vi . fn ( async ( ) => AsyncResult . success ( { ...snapshot , tabId : "new-tab" } ) ) ;
111142 const result = await reopenClosedView (
0 commit comments