mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 01:25:36 -05:00
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:
@@ -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']);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user