Changes to add pre/post deploy script to sqlproj (#11864)

* Initial changes for adding pre/post deploy script in project

* Right click > Add pre/post deploy script

* Print script files in tree

* Add new pre-post deploy items with their own tags and additional ones with None

* Add tests

* Fix error due to merge conflicts

* Addressed comments and fixed tests.

* Fix code scan error

* Addressed comments
This commit is contained in:
Sakshi Sharma
2020-08-27 10:50:02 -07:00
committed by GitHub
parent fa664bc92f
commit 21c8609eb7
12 changed files with 160 additions and 17 deletions

View File

@@ -243,6 +243,25 @@ describe('ProjectsController', function (): void {
should(await exists(scriptEntry.fsUri.fsPath)).equal(true, 'script is supposed to still exist on disk');
});
it('Should be able to add pre deploy and post deploy script', async function (): Promise<void> {
const preDeployScriptName = 'PreDeployScript1.sql';
const postDeployScriptName = 'PostDeployScript1.sql';
const projController = new ProjectsController(new SqlDatabaseProjectTreeViewProvider());
const project = await testUtils.createTestProject(baselines.newProjectFileBaseline);
sinon.stub(vscode.window, 'showInputBox').resolves(preDeployScriptName);
should(project.preDeployScripts.length).equal(0, 'There should be no pre deploy scripts');
await projController.addItemPrompt(project, '', templates.preDeployScript);
should(project.preDeployScripts.length).equal(1, `Pre deploy script should be successfully added. ${project.preDeployScripts.length}, ${project.files.length}`);
sinon.restore();
sinon.stub(vscode.window, 'showInputBox').resolves(postDeployScriptName);
should(project.postDeployScripts.length).equal(0, 'There should be no post deploy scripts');
await projController.addItemPrompt(project, '', templates.postDeployScript);
should(project.postDeployScripts.length).equal(1, 'Post deploy script should be successfully added');
});
});
describe('Publishing and script generation', function (): void {