fix for windows path to show in project tree across platforms correctly (#11027)

* fix for windows path to show in project tree across platforms correctly

* allow retrying on project that failed to load

* test for project failed to load case

* Adding platform safe uri for database ref in tree
This commit is contained in:
Udeesha Gautam
2020-06-22 22:37:24 -07:00
committed by GitHub
parent d0b71e116b
commit cfbce96fe2
5 changed files with 60 additions and 3 deletions

View File

@@ -93,4 +93,27 @@ describe.skip('Project Tree tests', function (): void {
DatabaseProjectItemType.file,
DatabaseProjectItemType.file]);
});
it('Should be able to parse windows relative path as platform safe path', async function (): Promise<void> {
const root = os.platform() === 'win32' ? 'Z:\\' : '/';
const proj = new Project(vscode.Uri.file(`${root}TestProj.sqlproj`).fsPath);
// nested entries before explicit top-level folder entry
// also, ordering of files/folders at all levels
proj.files.push(proj.createProjectEntry('someFolder1\\MyNestedFolder1\\MyFile1.sql', EntryType.File));
proj.files.push(proj.createProjectEntry('someFolder1\\MyNestedFolder2', EntryType.Folder));
proj.files.push(proj.createProjectEntry('someFolder1\\MyFile2.sql', EntryType.File));
const tree = new ProjectRootTreeItem(proj);
should(tree.children.map(x => x.uri.path)).deepEqual([
'/TestProj.sqlproj/Data Sources',
'/TestProj.sqlproj/Database References',
'/TestProj.sqlproj/someFolder1']);
// Why are we only matching names - https://github.com/microsoft/azuredatastudio/issues/11026
should(tree.children.find(x => x.uri.path === '/TestProj.sqlproj/someFolder1')?.children.map(y => path.basename(y.uri.path))).deepEqual([
'MyNestedFolder1',
'MyNestedFolder2',
'MyFile2.sql']);
});
});