mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 09:35:37 -05:00
Move promptAddItem to extension API (#19423)
* Move addItem to extension API * add noneDeployScripts
This commit is contained in:
@@ -30,7 +30,7 @@ import { AddDatabaseReferenceDialog } from '../dialogs/addDatabaseReferenceDialo
|
||||
import { IDacpacReferenceSettings } from '../models/IDatabaseReferenceSettings';
|
||||
import { CreateProjectFromDatabaseDialog } from '../dialogs/createProjectFromDatabaseDialog';
|
||||
import { ImportDataModel } from '../models/api/import';
|
||||
import { SqlTargetPlatform } from 'sqldbproj';
|
||||
import { ItemType, SqlTargetPlatform } from 'sqldbproj';
|
||||
import { SystemDatabaseReferenceProjectEntry, SystemDatabase, EntryType, FileProjectEntry } from '../models/projectEntry';
|
||||
|
||||
let testContext: TestContext;
|
||||
@@ -96,7 +96,7 @@ describe('ProjectsController', function (): void {
|
||||
const project = new Project('FakePath');
|
||||
|
||||
should(project.files.length).equal(0);
|
||||
await projController.addItemPrompt(new Project('FakePath'), '', templates.script);
|
||||
await projController.addItemPrompt(new Project('FakePath'), '', 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(showErrorMessageSpy.notCalled).be.true('showErrorMessage should not have been called');
|
||||
showInputBoxStub.restore();
|
||||
@@ -112,9 +112,9 @@ describe('ProjectsController', function (): void {
|
||||
const project = await testUtils.createTestProject(baselines.newProjectFileBaseline);
|
||||
|
||||
should(project.files.length).equal(0, 'There should be no files');
|
||||
await projController.addItemPrompt(project, '', templates.script);
|
||||
await projController.addItemPrompt(project, '', ItemType.script);
|
||||
should(project.files.length).equal(1, 'File should be successfully added');
|
||||
await projController.addItemPrompt(project, '', templates.script);
|
||||
await projController.addItemPrompt(project, '', ItemType.script);
|
||||
const msg = constants.fileAlreadyExists(tableName);
|
||||
should(spy.calledOnce).be.true('showErrorMessage should have been called exactly once');
|
||||
should(spy.calledWith(msg)).be.true(`showErrorMessage not called with expected message '${msg}' Actual '${spy.getCall(0).args[0]}'`);
|
||||
@@ -327,13 +327,13 @@ describe('ProjectsController', function (): void {
|
||||
|
||||
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);
|
||||
await projController.addItemPrompt(project, '', ItemType.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);
|
||||
await projController.addItemPrompt(project, '', ItemType.postDeployScript);
|
||||
should(project.postDeployScripts.length).equal(1, 'Post deploy script should be successfully added');
|
||||
});
|
||||
|
||||
@@ -739,9 +739,9 @@ async function setupDeleteExcludeTest(proj: Project): Promise<[FileProjectEntry,
|
||||
const scriptEntry = await proj.addScriptItem('UpperFolder/LowerFolder/someScript.sql', 'not a real script');
|
||||
await proj.addScriptItem('UpperFolder/LowerFolder/someOtherScript.sql', 'Also not a real script');
|
||||
await proj.addScriptItem('../anotherScript.sql', 'Also not a real script');
|
||||
const preDeployEntry = await proj.addScriptItem('Script.PreDeployment1.sql', 'pre-deployment stuff', templates.preDeployScript);
|
||||
const noneEntry = await proj.addScriptItem('Script.PreDeployment2.sql', 'more pre-deployment stuff', templates.preDeployScript);
|
||||
const postDeployEntry = await proj.addScriptItem('Script.PostDeployment1.sql', 'post-deployment stuff', templates.postDeployScript);
|
||||
const preDeployEntry = await proj.addScriptItem('Script.PreDeployment1.sql', 'pre-deployment stuff', ItemType.preDeployScript);
|
||||
const noneEntry = await proj.addScriptItem('Script.PreDeployment2.sql', 'more pre-deployment stuff', ItemType.preDeployScript);
|
||||
const postDeployEntry = await proj.addScriptItem('Script.PostDeployment1.sql', 'post-deployment stuff', ItemType.postDeployScript);
|
||||
|
||||
const projTreeRoot = new ProjectRootTreeItem(proj);
|
||||
sinon.stub(vscode.window, 'showWarningMessage').returns(<any>Promise.resolve(constants.yesString));
|
||||
|
||||
Reference in New Issue
Block a user