@@ -296,31 +296,23 @@ suite('BackupMainService', () => {
296296
297297 test ( 'migrate storage file' , async ( ) => {
298298 let folderPath = path . join ( parentDir , 'f1' ) ;
299+ ensureFolderExists ( URI . file ( folderPath ) ) ;
299300 const backupFolderPath = service . toLegacyBackupPath ( folderPath ) ;
300- if ( ! fs . existsSync ( backupFolderPath ) ) {
301- fs . mkdirSync ( backupFolderPath ) ;
302- fs . mkdirSync ( path . join ( backupFolderPath , Schemas . file ) ) ;
303- await pfs . writeFile ( path . join ( backupFolderPath , Schemas . file , 'unsaved1.txt' ) , 'Legacy' ) ;
304- }
301+ await createBackupFolder ( backupFolderPath ) ;
305302
306303 let workspacePath = path . join ( parentDir , 'f2.code-workspace' ) ;
307304 const workspace = toWorkspace ( workspacePath ) ;
308-
309- const backupWorkspacePath = service . toBackupPath ( workspace . id ) ;
310- if ( ! fs . existsSync ( backupWorkspacePath ) ) {
311- fs . mkdirSync ( backupWorkspacePath ) ;
312- fs . mkdirSync ( path . join ( backupWorkspacePath , Schemas . file ) ) ;
313- await pfs . writeFile ( path . join ( backupWorkspacePath , Schemas . file , 'unsaved2.txt' ) , 'Legacy' ) ;
314- }
315-
305+ await ensureWorkspaceExists ( workspace ) ;
316306
317307 const workspacesJson = { rootWorkspaces : [ { id : workspace . id , configPath : workspacePath } ] , folderWorkspaces : [ folderPath ] , emptyWorkspaces : [ ] } ;
318308 await pfs . writeFile ( backupWorkspacesPath , JSON . stringify ( workspacesJson ) ) ;
319309 await service . initialize ( ) ;
320310 const content = await pfs . readFile ( backupWorkspacesPath , 'utf-8' ) ;
321311 const json = ( < IBackupWorkspacesFormat > JSON . parse ( content ) ) ;
322312 assert . deepEqual ( json . folderURIWorkspaces , [ URI . file ( folderPath ) . toString ( ) ] ) ;
323- assert . deepEqual ( json . rootURIWorkspaces , [ { id : workspace . id , configPath : URI . file ( workspacePath ) . toString ( ) } ] ) ;
313+ assert . deepEqual ( json . rootURIWorkspaces , [ { id : workspace . id , configURIPath : URI . file ( workspacePath ) . toString ( ) } ] ) ;
314+
315+ assertEqualUris ( service . getWorkspaceBackups ( ) . map ( w => w . configPath ) , [ workspace . configPath ] ) ;
324316 } ) ;
325317 } ) ;
326318
0 commit comments