update sql projects test (#17987)

This commit is contained in:
Kim Santiago
2022-01-05 10:03:24 -08:00
committed by GitHub
parent b2c919e054
commit e11b1ed2a3
2 changed files with 6 additions and 5 deletions

View File

@@ -660,6 +660,8 @@ export class ProjectsController {
if (root && fileOrFolder) { if (root && fileOrFolder) {
// use relative path and not tree paths for files and folder // use relative path and not tree paths for files and folder
const allFileEntries = project.files.concat(project.preDeployScripts).concat(project.postDeployScripts).concat(project.noneDeployScripts); const allFileEntries = project.files.concat(project.preDeployScripts).concat(project.postDeployScripts).concat(project.noneDeployScripts);
// trim trailing slash since folders with and without a trailing slash are allowed in a sqlproj
const trimmedUri = utils.trimChars(utils.getPlatformSafeFileEntryPath(utils.trimUri(root.fileSystemUri, fileOrFolder.fileSystemUri)), '/'); const trimmedUri = utils.trimChars(utils.getPlatformSafeFileEntryPath(utils.trimUri(root.fileSystemUri, fileOrFolder.fileSystemUri)), '/');
return allFileEntries.find(x => utils.trimChars(utils.getPlatformSafeFileEntryPath(x.relativePath), '/') === trimmedUri); return allFileEntries.find(x => utils.trimChars(utils.getPlatformSafeFileEntryPath(x.relativePath), '/') === trimmedUri);
} }

View File

@@ -108,11 +108,10 @@ describe('Project Tree tests', function (): void {
'/TestProj/Database References', '/TestProj/Database References',
'/TestProj/someFolder1']); '/TestProj/someFolder1']);
// Why are we only matching names - https://github.com/microsoft/azuredatastudio/issues/11026 should(tree.children.find(x => x.projectUri.path === '/TestProj/someFolder1')?.children.map(y => y.projectUri.path)).deepEqual([
should(tree.children.find(x => x.projectUri.path === '/TestProj/someFolder1')?.children.map(y => path.basename(y.projectUri.path))).deepEqual([ '/TestProj/someFolder1/MyNestedFolder1',
'MyNestedFolder1', '/TestProj/someFolder1/MyNestedFolder2',
'MyNestedFolder2', '/TestProj/someFolder1/MyFile2.sql']);
'MyFile2.sql']);
}); });
it('Should be able to parse and include relative paths outside project folder', function (): void { it('Should be able to parse and include relative paths outside project folder', function (): void {