Changing "files" to "sqlObjectScripts" to be more accurate (#22899)

* Changing "files" to "sqlObjectScripts" to be more accurate

* fixing func call
This commit is contained in:
Benjin Dubishar
2023-05-01 08:31:13 -07:00
committed by GitHub
parent b86463ee71
commit 6b1dd0e468
8 changed files with 85 additions and 85 deletions

View File

@@ -33,7 +33,7 @@ describe('Project: sqlproj content operations', function (): void {
const project: Project = await Project.openProject(projFilePath);
// Files and folders
(project.files.map(f => f.relativePath)).should.deepEqual([
(project.sqlObjectScripts.map(f => f.relativePath)).should.deepEqual([
'..\\Test\\Test.sql',
'MyExternalStreamingJob.sql',
'Tables\\Action History.sql',
@@ -118,18 +118,18 @@ describe('Project: sqlproj content operations', function (): void {
const scriptContentsTagged = 'EXEC sys.sp_create_streaming_job \'job\', \'SELECT 7\'';
(project.folders.length).should.equal(0);
(project.files.length).should.equal(0);
(project.sqlObjectScripts.length).should.equal(0);
await project.addFolder(folderPath);
await project.addScriptItem(scriptPath, scriptContents);
await project.addScriptItem(scriptPathTagged, scriptContentsTagged, ItemType.externalStreamingJob);
(project.folders.length).should.equal(1);
(project.files.length).should.equal(2);
(project.sqlObjectScripts.length).should.equal(2);
should(project.folders.find(f => f.relativePath === convertSlashesForSqlProj(folderPath))).not.equal(undefined);
should(project.files.find(f => f.relativePath === convertSlashesForSqlProj(scriptPath))).not.equal(undefined);
should(project.files.find(f => f.relativePath === convertSlashesForSqlProj(scriptPathTagged))).not.equal(undefined);
should(project.sqlObjectScripts.find(f => f.relativePath === convertSlashesForSqlProj(scriptPath))).not.equal(undefined);
should(project.sqlObjectScripts.find(f => f.relativePath === convertSlashesForSqlProj(scriptPathTagged))).not.equal(undefined);
// TODO: support for tagged entries not supported in DacFx.Projects
//should(project.files.find(f => f.relativePath === convertSlashesForSqlProj(scriptPathTagged))?.sqlObjectType).equal(constants.ExternalStreamingJob);
});
@@ -138,7 +138,7 @@ describe('Project: sqlproj content operations', function (): void {
const project = await testUtils.createTestSqlProject(this.test);
// initial setup
(project.files.length).should.equal(0, 'initial number of scripts');
(project.sqlObjectScripts.length).should.equal(0, 'initial number of scripts');
// create files on disk
const tablePath = path.join(project.projectFolderPath, 'MyTable.sql');
@@ -151,7 +151,7 @@ describe('Project: sqlproj content operations', function (): void {
await project.addSqlObjectScripts(['MyTable.sql', 'MyView.sql']);
// verify result
(project.files.length).should.equal(2, 'Number of scripts after adding');
(project.sqlObjectScripts.length).should.equal(2, 'Number of scripts after adding');
});
// TODO: move to DacFx once script contents supported
@@ -261,7 +261,7 @@ describe('Project: sqlproj content operations', function (): void {
// Try adding project root folder itself - this is silently ignored
await project.addFolder(path.dirname(projFilePath));
should.equal(project.files.length, 0, 'Nothing should be added to the project');
should.equal(project.sqlObjectScripts.length, 0, 'Nothing should be added to the project');
// Try adding a parent of the project folder
await testUtils.shouldThrowSpecificError(
@@ -288,8 +288,8 @@ describe('Project: sqlproj content operations', function (): void {
await project.addExistingItem(txtFile);
// Validate files should have been added to project
(project.files.length).should.equal(1, `SQL script object count: ${project.files.map(x => x.relativePath).join('; ')}`);
(project.files[0].relativePath).should.equal('test.sql');
(project.sqlObjectScripts.length).should.equal(1, `SQL script object count: ${project.sqlObjectScripts.map(x => x.relativePath).join('; ')}`);
(project.sqlObjectScripts[0].relativePath).should.equal('test.sql');
should(project.folders.length).equal(1, 'folders');
(project.folders[0].relativePath).should.equal('foo');
@@ -336,7 +336,7 @@ describe('Project: sdk style project content operations', function (): void {
should(project.preDeployScripts.length).equal(1, 'Script.PreDeployment1.sql should have been added');
should(project.noneDeployScripts.length).equal(1, 'Script.PreDeployment2.sql should have been added');
should(project.preDeployScripts.length).equal(1, 'Script.PostDeployment1.sql should have been added');
should(project.files.length).equal(0, 'There should not be any SQL object scripts');
should(project.sqlObjectScripts.length).equal(0, 'There should not be any SQL object scripts');
// exclude the pre/post/none deploy script
await project.excludePreDeploymentScript('Script.PreDeployment1.sql');
@@ -346,7 +346,7 @@ describe('Project: sdk style project content operations', function (): void {
should(project.preDeployScripts.length).equal(0, 'Script.PreDeployment1.sql should have been removed');
should(project.noneDeployScripts.length).equal(0, 'Script.PreDeployment2.sql should have been removed');
should(project.postDeployScripts.length).equal(0, 'Script.PostDeployment1.sql should have been removed');
should(project.files.length).equal(0, 'There should not be any SQL object scripts after the excludes');
should(project.sqlObjectScripts.length).equal(0, 'There should not be any SQL object scripts after the excludes');
});
it('Should handle excluding glob included folders', async function (): Promise<void> {
@@ -356,7 +356,7 @@ describe('Project: sdk style project content operations', function (): void {
const project: Project = await Project.openProject(projFilePath);
should(project.files.length).equal(13);
should(project.sqlObjectScripts.length).equal(13);
should(project.folders.length).equal(3);
should(project.noneDeployScripts.length).equal(2);
@@ -365,7 +365,7 @@ describe('Project: sdk style project content operations', function (): void {
// verify folder and contents are excluded
should(project.folders.length).equal(1);
should(project.files.length).equal(6);
should(project.sqlObjectScripts.length).equal(6);
should(project.noneDeployScripts.length).equal(1, 'Script.PostDeployment2.sql should have been excluded');
should(project.folders.find(f => f.relativePath === 'folder1')).equal(undefined);
});
@@ -377,7 +377,7 @@ describe('Project: sdk style project content operations', function (): void {
const project: Project = await Project.openProject(projFilePath);
should(project.files.length).equal(13);
should(project.sqlObjectScripts.length).equal(13);
should(project.folders.length).equal(3);
// try to exclude a glob included folder
@@ -385,7 +385,7 @@ describe('Project: sdk style project content operations', function (): void {
// verify folder and contents are excluded
should(project.folders.length).equal(2);
should(project.files.length).equal(11);
should(project.sqlObjectScripts.length).equal(11);
should(project.folders.find(f => f.relativePath === 'folder1\\nestedFolder')).equal(undefined);
});
@@ -397,7 +397,7 @@ describe('Project: sdk style project content operations', function (): void {
const project: Project = await Project.openProject(projFilePath);
should(project.files.length).equal(11);
should(project.sqlObjectScripts.length).equal(11);
should(project.folders.length).equal(2);
should(project.folders.find(f => f.relativePath === 'folder1')!).not.equal(undefined);
should(project.folders.find(f => f.relativePath === 'folder2')!).not.equal(undefined);
@@ -407,7 +407,7 @@ describe('Project: sdk style project content operations', function (): void {
// verify folder and contents are excluded
should(project.folders.length).equal(1);
should(project.files.length).equal(6);
should(project.sqlObjectScripts.length).equal(6);
should(project.folders.find(f => f.relativePath === 'folder1')).equal(undefined);
// try to exclude an explicitly included folder with trailing \ in sqlproj
@@ -415,7 +415,7 @@ describe('Project: sdk style project content operations', function (): void {
// verify folder and contents are excluded
should(project.folders.length).equal(0);
should(project.files.length).equal(1);
should(project.sqlObjectScripts.length).equal(1);
should(project.folders.find(f => f.relativePath === 'folder2')).equal(undefined);
});
@@ -426,7 +426,7 @@ describe('Project: sdk style project content operations', function (): void {
const project: Project = await Project.openProject(projFilePath);
should(project.files.length).equal(13);
should(project.sqlObjectScripts.length).equal(13);
should(project.folders.length).equal(3);
should(project.folders.find(f => f.relativePath === 'folder1')!).not.equal(undefined);
should(project.folders.find(f => f.relativePath === 'folder2')!).not.equal(undefined);
@@ -436,7 +436,7 @@ describe('Project: sdk style project content operations', function (): void {
// verify the project not longer has folder2 and its contents
should(project.folders.length).equal(2);
should(project.files.length).equal(8);
should(project.sqlObjectScripts.length).equal(8);
should(project.folders.find(f => f.relativePath === 'folder2')).equal(undefined);
// try to delete an explicitly included folder without trailing \ in sqlproj
@@ -444,7 +444,7 @@ describe('Project: sdk style project content operations', function (): void {
// verify the project not longer has folder1 and its contents
should(project.folders.length).equal(0);
should(project.files.length).equal(1);
should(project.sqlObjectScripts.length).equal(1);
should(project.folders.find(f => f.relativePath === 'folder1')).equal(undefined);
});

View File

@@ -87,7 +87,7 @@ describe('ProjectsController', function (): void {
});
const project = await Project.openProject(projFilePath);
should(project.files.length).equal(7, `The 7 template files for an edge project should be present. Actual: ${project.files.length}`);
should(project.sqlObjectScripts.length).equal(7, `The 7 template files for an edge project should be present. Actual: ${project.sqlObjectScripts.length}`);
});
it('Should return silently when no SQL object name provided in prompts', async function (): Promise<void> {
@@ -98,9 +98,9 @@ describe('ProjectsController', function (): void {
const projController = new ProjectsController(testContext.outputChannel);
const project = new Project('FakePath');
should(project.files.length).equal(0);
should(project.sqlObjectScripts.length).equal(0);
await projController.addItemPrompt(new Project('FakePath'), '', { itemType: ItemType.script });
should(project.files.length).equal(0, 'Expected to return without throwing an exception or adding a file when an empty/undefined name is provided.');
should(project.sqlObjectScripts.length).equal(0, 'Expected to return without throwing an exception or adding a file when an empty/undefined name is provided.');
should(showErrorMessageSpy.notCalled).be.true('showErrorMessage should not have been called');
sinon.restore();
}
@@ -114,10 +114,10 @@ describe('ProjectsController', function (): void {
const projController = new ProjectsController(testContext.outputChannel);
let project = await testUtils.createTestProject(this.test, baselines.newProjectFileBaseline);
should(project.files.length).equal(0, 'There should be no files');
should(project.sqlObjectScripts.length).equal(0, 'There should be no files');
await projController.addItemPrompt(project, '', { itemType: ItemType.script });
should(project.files.length).equal(1, 'File should be successfully added');
should(project.sqlObjectScripts.length).equal(1, 'File should be successfully added');
await projController.addItemPrompt(project, '', { itemType: ItemType.script });
const msg = constants.fileAlreadyExists(tableName);
should(spy.calledOnce).be.true('showErrorMessage should have been called exactly once');
@@ -130,9 +130,9 @@ describe('ProjectsController', function (): void {
const projController = new ProjectsController(testContext.outputChannel);
const project = await testUtils.createTestProject(this.test, baselines.newProjectFileBaseline);
should(project.files.length).equal(0, 'There should be no files');
should(project.sqlObjectScripts.length).equal(0, 'There should be no files');
await projController.addItemPrompt(project, '');
should(project.files.length).equal(0, 'File should not have been added');
should(project.sqlObjectScripts.length).equal(0, 'File should not have been added');
should(spy.called).be.false(`showErrorMessage should not have been called called. Actual '${spy.getCall(0)?.args[0]}'`);
});
@@ -144,9 +144,9 @@ describe('ProjectsController', function (): void {
const projController = new ProjectsController(testContext.outputChannel);
let project = await testUtils.createTestProject(this.test, baselines.newProjectFileBaseline);
should(project.files.length).equal(0, 'There should be no files');
should(project.sqlObjectScripts.length).equal(0, 'There should be no files');
await projController.addItemPrompt(project, '', { itemType: ItemType.script });
should(project.files.length).equal(1, 'File should be successfully added');
should(project.sqlObjectScripts.length).equal(1, 'File should be successfully added');
// exclude item
const projTreeRoot = new ProjectRootTreeItem(project);
@@ -154,7 +154,7 @@ describe('ProjectsController', function (): void {
// reload project
project = await Project.openProject(project.projectFilePath);
should(project.files.length).equal(0, 'File should be successfully excluded');
should(project.sqlObjectScripts.length).equal(0, 'File should be successfully excluded');
should(spy.called).be.false(`showErrorMessage not called with expected message. Actual '${spy.getCall(0)?.args[0]}'`);
// add item back
@@ -163,7 +163,7 @@ describe('ProjectsController', function (): void {
// reload project
project = await Project.openProject(project.projectFilePath);
should(project.files.length).equal(1, 'File should be successfully re-added');
should(project.sqlObjectScripts.length).equal(1, 'File should be successfully re-added');
});
it('Should show error if trying to add a folder that already exists', async function (): Promise<void> {
@@ -219,7 +219,7 @@ describe('ProjectsController', function (): void {
// reload project
project = await Project.openProject(project.projectFilePath);
should(project.folders.length).equal(beforeFolderCount + 1, `Folder count should be increased by one after adding the folder ${folderName}. before folders: ${JSON.stringify(beforeFolders)}/n after folders: ${JSON.stringify(project.files.map(f => f.relativePath))}`);
should(project.folders.length).equal(beforeFolderCount + 1, `Folder count should be increased by one after adding the folder ${folderName}. before folders: ${JSON.stringify(beforeFolders)}/n after folders: ${JSON.stringify(project.sqlObjectScripts.map(f => f.relativePath))}`);
sinon.restore();
}
@@ -254,7 +254,7 @@ describe('ProjectsController', function (): void {
proj = await Project.openProject(proj.projectFilePath); // reload edited sqlproj from disk
// confirm result
should(proj.files.length).equal(3, 'number of file entries'); // lowerEntry and the contained scripts should be deleted
should(proj.sqlObjectScripts.length).equal(3, 'number of file entries'); // lowerEntry and the contained scripts should be deleted
should(proj.folders[0].relativePath).equal('UpperFolder');
should(proj.preDeployScripts.length).equal(0, 'Pre Deployment scripts should have been deleted');
should(proj.postDeployScripts.length).equal(0, 'Post Deployment scripts should have been deleted');
@@ -318,7 +318,7 @@ describe('ProjectsController', function (): void {
proj = await Project.openProject(proj.projectFilePath); // reload edited sqlproj from disk
// confirm result
should(proj.files.length).equal(0, 'number of file entries'); // LowerFolder and the contained scripts should be excluded
should(proj.sqlObjectScripts.length).equal(0, 'number of file entries'); // LowerFolder and the contained scripts should be excluded
should(proj.folders.find(f => f.relativePath === 'UpperFolder')).not.equal(undefined, 'UpperFolder should still be there');
should(proj.preDeployScripts.length).equal(0, 'Pre deployment scripts');
should(proj.postDeployScripts.length).equal(0, 'Post deployment scripts');
@@ -338,7 +338,7 @@ describe('ProjectsController', function (): void {
const projTreeRoot = new ProjectRootTreeItem(proj);
should(await utils.exists(path.join(proj.projectFolderPath, 'SomeFolder\\MyTable.sql'))).be.true('File should exist in original location');
(proj.files.length).should.equal(1, 'Starting number of files');
(proj.sqlObjectScripts.length).should.equal(1, 'Starting number of scripts');
(proj.folders.length).should.equal(1, 'Starting number of folders');
// exclude folder
@@ -349,7 +349,7 @@ describe('ProjectsController', function (): void {
proj = await Project.openProject(proj.projectFilePath);
should(await utils.exists(path.join(proj.projectFolderPath, 'SomeFolder\\MyTable.sql'))).be.true('File should still exist on disk');
(proj.files.length).should.equal(0, 'Number of files should not have changed');
(proj.sqlObjectScripts.length).should.equal(0, 'Number of scripts should not have changed');
(proj.folders.length).should.equal(0, 'Number of folders should not have changed');
});
@@ -375,7 +375,7 @@ describe('ProjectsController', function (): void {
proj = await Project.openProject(proj.projectFilePath);
// Confirm result
should(proj.files.some(x => x.relativePath === 'UpperFolder')).equal(false, 'UpperFolder should not be part of proj file any more');
should(proj.sqlObjectScripts.some(x => x.relativePath === 'UpperFolder')).equal(false, 'UpperFolder should not be part of proj file any more');
should(await utils.exists(scriptEntry.fsUri.fsPath)).equal(false, 'script is supposed to be deleted from disk');
should(await utils.exists(lowerFolder.relativeProjectUri.fsPath)).equal(false, 'LowerFolder is supposed to be deleted from disk');
should(await utils.exists(upperFolder.relativeProjectUri.fsPath)).equal(false, 'UpperFolder is supposed to be deleted from disk');
@@ -392,7 +392,7 @@ describe('ProjectsController', function (): void {
// change the sql project file
await fs.writeFile(sqlProjPath, baselines.newProjectFileWithScriptBaseline);
should(project.files.length).equal(0);
should(project.sqlObjectScripts.length).equal(0);
// call reload project
const projTreeRoot = new ProjectRootTreeItem(project);
@@ -404,7 +404,7 @@ describe('ProjectsController', function (): void {
treeProvider.load([project]);
// check that the new project is in the tree
should(project.files.length).equal(1);
should(project.sqlObjectScripts.length).equal(1);
should(treeProvider.getChildren()[0].children.find(c => c.friendlyName === 'Script1.sql')).not.equal(undefined);
});
@@ -419,7 +419,7 @@ describe('ProjectsController', function (): void {
sinon.stub(utils, 'sanitizeStringForFilename').returns(preDeployScriptName);
should(project.preDeployScripts.length).equal(0, 'There should be no pre deploy scripts');
await projController.addItemPrompt(project, '', { itemType: ItemType.preDeployScript });
should(project.preDeployScripts.length).equal(1, `Pre deploy script should be successfully added. ${project.preDeployScripts.length}, ${project.files.length}`);
should(project.preDeployScripts.length).equal(1, `Pre deploy script should be successfully added. ${project.preDeployScripts.length}, ${project.sqlObjectScripts.length}`);
sinon.restore();
sinon.stub(vscode.window, 'showInputBox').resolves(postDeployScriptName);
@@ -835,10 +835,10 @@ describe('ProjectsController', function (): void {
should(actual).equal(constants.autorestPostDeploymentScriptName, `Unexpected post-deployment script name: ${actual}, expected ${constants.autorestPostDeploymentScriptName}`);
const expectedScripts = fileList.filter(f => path.extname(f.fsPath) === '.sql');
should(project.files.filter(f => f.type === EntryType.File).length).equal(expectedScripts.length, 'Unexpected number of scripts in project');
should(project.sqlObjectScripts.filter(f => f.type === EntryType.File).length).equal(expectedScripts.length, 'Unexpected number of scripts in project');
const expectedFolders = fileList.filter(f => path.extname(f.fsPath) === '' && f.fsPath.toUpperCase() !== newProjFolder.toUpperCase());
should(project.files.filter(f => f.type === EntryType.Folder).length).equal(expectedFolders.length, 'Unexpected number of folders in project');
should(project.sqlObjectScripts.filter(f => f.type === EntryType.Folder).length).equal(expectedFolders.length, 'Unexpected number of folders in project');
});
});
@@ -862,7 +862,7 @@ describe('ProjectsController', function (): void {
// reload project and verify file was moved
proj = await Project.openProject(proj.projectFilePath);
should(proj.files.find(f => f.relativePath === 'UpperFolder\\script1.sql') !== undefined).be.true('The file path should have been updated');
should(proj.sqlObjectScripts.find(f => f.relativePath === 'UpperFolder\\script1.sql') !== undefined).be.true('The file path should have been updated');
should(await utils.exists(path.join(proj.projectFolderPath, 'UpperFolder', 'script1.sql'))).be.true('The moved file should exist');
});
@@ -884,7 +884,7 @@ describe('ProjectsController', function (): void {
// reload project and verify file was not moved
proj = await Project.openProject(proj.projectFilePath);
should(proj.files.find(f => f.relativePath === 'script1.sql') !== undefined).be.true(`The file path should not have been updated when trying to move script1.sql to ${folder}`);
should(proj.sqlObjectScripts.find(f => f.relativePath === 'script1.sql') !== undefined).be.true(`The file path should not have been updated when trying to move script1.sql to ${folder}`);
should(spy.notCalled).be.true('showErrorMessage should not have been called.');
spy.restore();
}
@@ -943,7 +943,7 @@ describe('ProjectsController', function (): void {
// verify script1.sql was not moved
proj1 = await Project.openProject(proj1.projectFilePath);
should(proj1.files.find(f => f.relativePath === 'script1.sql') !== undefined).be.true(`The file path should not have been updated when trying to move script1.sql to proj2`);
should(proj1.sqlObjectScripts.find(f => f.relativePath === 'script1.sql') !== undefined).be.true(`The file path should not have been updated when trying to move script1.sql to proj2`);
});
});
@@ -960,7 +960,7 @@ describe('ProjectsController', function (): void {
// reload project and verify file was not renamed
proj = await Project.openProject(proj.projectFilePath);
should(proj.files.find(f => f.relativePath === 'script1.sql') !== undefined).be.true('The file path should not have been updated');
should(proj.sqlObjectScripts.find(f => f.relativePath === 'script1.sql') !== undefined).be.true('The file path should not have been updated');
should(await utils.exists(path.join(proj.projectFolderPath, 'script1.sql'))).be.true('The moved file should exist');
});
@@ -976,7 +976,7 @@ describe('ProjectsController', function (): void {
// reload project and verify file was renamed
proj = await Project.openProject(proj.projectFilePath);
should(proj.files.find(f => f.relativePath === 'newName.sql') !== undefined).be.true('The file path should have been updated');
should(proj.sqlObjectScripts.find(f => f.relativePath === 'newName.sql') !== undefined).be.true('The file path should have been updated');
should(await utils.exists(path.join(proj.projectFolderPath, 'newName.sql'))).be.true('The moved file should exist');
});
@@ -1016,7 +1016,7 @@ describe('ProjectsController', function (): void {
sinon.stub(vscode.window, 'showInputBox').resolves('RenamedFolder');
should(await utils.exists(path.join(proj.projectFolderPath, 'SomeFolder\\MyTable.sql'))).be.true('File should exist in original location');
(proj.files.length).should.equal(1, 'Starting number of files');
(proj.sqlObjectScripts.length).should.equal(1, 'Starting number of scripts');
(proj.folders.length).should.equal(1, 'Starting number of folders');
// rename folder
@@ -1027,10 +1027,10 @@ describe('ProjectsController', function (): void {
proj = await Project.openProject(proj.projectFilePath);
should(await utils.exists(path.join(proj.projectFolderPath, 'RenamedFolder\\MyTable.sql'))).be.true('File should exist in new location');
(proj.files.length).should.equal(1, 'Number of files should not have changed');
(proj.sqlObjectScripts.length).should.equal(1, 'Number of scripts should not have changed');
(proj.folders.length).should.equal(1, 'Number of folders should not have changed');
should(proj.folders.find(f => f.relativePath === 'RenamedFolder') !== undefined).be.true('The folder path should have been updated');
should(proj.files.find(f => f.relativePath === 'RenamedFolder\\MyTable.sql') !== undefined).be.true('Path of the script in the folder should have been updated');
should(proj.sqlObjectScripts.find(f => f.relativePath === 'RenamedFolder\\MyTable.sql') !== undefined).be.true('Path of the script in the folder should have been updated');
});
});
@@ -1137,7 +1137,7 @@ async function setupDeleteExcludeTest(proj: Project): Promise<[FileProjectEntry,
sinon.stub(vscode.window, 'showWarningMessage').returns(<any>Promise.resolve(constants.yesString));
// confirm setup
should(proj.files.length).equal(3, 'number of file entries');
should(proj.sqlObjectScripts.length).equal(3, 'number of file entries');
should(proj.folders.length).equal(2, 'number of folder entries');
should(proj.preDeployScripts.length).equal(1, 'number of pre-deployment script entries');
should(proj.postDeployScripts.length).equal(1, 'number of post-deployment script entries');

View File

@@ -53,15 +53,15 @@ describe('Project Tree tests', function (): void {
// nested entries before explicit top-level folder entry
// also, ordering of files/folders at all levels
proj.files.push(proj.createFileProjectEntry(path.join('someFolder', 'bNestedTest.sql'), EntryType.File));
proj.sqlObjectScripts.push(proj.createFileProjectEntry(path.join('someFolder', 'bNestedTest.sql'), EntryType.File));
proj.folders.push(proj.createFileProjectEntry(path.join('someFolder', 'bNestedFolder'), EntryType.Folder));
proj.files.push(proj.createFileProjectEntry(path.join('someFolder', 'aNestedTest.sql'), EntryType.File));
proj.sqlObjectScripts.push(proj.createFileProjectEntry(path.join('someFolder', 'aNestedTest.sql'), EntryType.File));
proj.folders.push(proj.createFileProjectEntry(path.join('someFolder', 'aNestedFolder'), EntryType.Folder));
proj.folders.push(proj.createFileProjectEntry('someFolder', EntryType.Folder));
// duplicate files
proj.files.push(proj.createFileProjectEntry('duplicate.sql', EntryType.File));
proj.files.push(proj.createFileProjectEntry('duplicate.sql', EntryType.File));
proj.sqlObjectScripts.push(proj.createFileProjectEntry('duplicate.sql', EntryType.File));
proj.sqlObjectScripts.push(proj.createFileProjectEntry('duplicate.sql', EntryType.File));
// duplicate folders
proj.folders.push(proj.createFileProjectEntry('duplicateFolder', EntryType.Folder));
@@ -101,11 +101,11 @@ describe('Project Tree tests', function (): void {
// nested entries before explicit top-level folder entry
// also, ordering of files/folders at all levels
proj.files.push(proj.createFileProjectEntry('someFolder1\\MyNestedFolder1\\MyFile1.sql', EntryType.File));
proj.sqlObjectScripts.push(proj.createFileProjectEntry('someFolder1\\MyNestedFolder1\\MyFile1.sql', EntryType.File));
proj.folders.push(proj.createFileProjectEntry('someFolder1\\MyNestedFolder2', EntryType.Folder));
proj.folders.push(proj.createFileProjectEntry('someFolder1', EntryType.Folder));
proj.folders.push(proj.createFileProjectEntry('someFolder1\\MyNestedFolder1', EntryType.Folder));
proj.files.push(proj.createFileProjectEntry('someFolder1\\MyFile2.sql', EntryType.File));
proj.sqlObjectScripts.push(proj.createFileProjectEntry('someFolder1\\MyFile2.sql', EntryType.File));
const tree = new ProjectRootTreeItem(proj);
should(tree.children.map(x => x.relativeProjectUri.path)).deepEqual([
@@ -125,9 +125,9 @@ describe('Project Tree tests', function (): void {
// nested entries before explicit top-level folder entry
// also, ordering of files/folders at all levels
proj.files.push(proj.createFileProjectEntry('..\\someFolder1\\MyNestedFolder1\\MyFile1.sql', EntryType.File));
proj.files.push(proj.createFileProjectEntry('..\\..\\someFolder2\\MyFile2.sql', EntryType.File));
proj.files.push(proj.createFileProjectEntry('..\\..\\someFolder3', EntryType.Folder)); // folder should not be counted (same as SSDT)
proj.sqlObjectScripts.push(proj.createFileProjectEntry('..\\someFolder1\\MyNestedFolder1\\MyFile1.sql', EntryType.File));
proj.sqlObjectScripts.push(proj.createFileProjectEntry('..\\..\\someFolder2\\MyFile2.sql', EntryType.File));
proj.sqlObjectScripts.push(proj.createFileProjectEntry('..\\..\\someFolder3', EntryType.Folder)); // folder should not be counted (same as SSDT)
const tree = new ProjectRootTreeItem(proj);
should(tree.children.map(x => x.relativeProjectUri.path)).deepEqual([