Allow edit of sqlproj in place and reload (#11980)

* edit sql proj file

* bug fix

* updating reload project method

* adding test for reload

* formatting
This commit is contained in:
anjalia
2020-09-03 10:08:12 -07:00
committed by GitHub
parent 887ce88100
commit d97993e518
9 changed files with 162 additions and 0 deletions

View File

@@ -246,6 +246,26 @@ describe('ProjectsController', function (): void {
should(await exists(scriptEntry.fsUri.fsPath)).equal(true, 'script is supposed to still exist on disk');
});
it('Should reload correctly after changing sqlproj file', async function (): Promise<void> {
// create project
const folderPath = await testUtils.generateTestFolderPath();
const sqlProjPath = await testUtils.createTestSqlProjFile(baselines.newProjectFileBaseline, folderPath);
const treeProvider = new SqlDatabaseProjectTreeViewProvider();
const projController = new ProjectsController(treeProvider);
const project = await projController.openProject(vscode.Uri.file(sqlProjPath));
// change the sql project file
await fs.writeFile(sqlProjPath, baselines.newProjectFileWithScriptBaseline);
should(project.files.length).equal(0);
// call reload project
await projController.reloadProject(vscode.Uri.file(project.projectFilePath));
should(project.files.length).equal(1);
// check that the new project is in the tree
should(treeProvider.getChildren()[0].children.find(c => c.friendlyName === 'Script1.sql')).not.equal(undefined);
});
it('Should be able to add pre deploy and post deploy script', async function (): Promise<void> {
const preDeployScriptName = 'PreDeployScript1.sql';
const postDeployScriptName = 'PostDeployScript1.sql';