mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Cleanup publish database dialog and test sqllint errors (#11178)
* cleanup publish database dialog and test * fix more tests * fix other tests * add back skips * use Promise.resolve()
This commit is contained in:
@@ -253,7 +253,7 @@ export class PublishDatabaseDialog {
|
|||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
this.connectionsRadioButton.checked = true;
|
this.connectionsRadioButton.checked = true;
|
||||||
this.connectionsRadioButton.onDidClick(async () => {
|
this.connectionsRadioButton.onDidClick(() => {
|
||||||
this.formBuilder!.removeFormItem(<azdata.FormComponent>this.dataSourcesFormComponent);
|
this.formBuilder!.removeFormItem(<azdata.FormComponent>this.dataSourcesFormComponent);
|
||||||
this.formBuilder!.insertFormItem(<azdata.FormComponent>this.targetConnectionFormComponent, 2);
|
this.formBuilder!.insertFormItem(<azdata.FormComponent>this.targetConnectionFormComponent, 2);
|
||||||
this.connectionIsDataSource = false;
|
this.connectionIsDataSource = false;
|
||||||
@@ -266,7 +266,7 @@ export class PublishDatabaseDialog {
|
|||||||
label: constants.dataSourceRadioButtonLabel
|
label: constants.dataSourceRadioButtonLabel
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
this.dataSourcesRadioButton.onDidClick(async () => {
|
this.dataSourcesRadioButton.onDidClick(() => {
|
||||||
this.formBuilder!.removeFormItem(<azdata.FormComponent>this.targetConnectionFormComponent);
|
this.formBuilder!.removeFormItem(<azdata.FormComponent>this.targetConnectionFormComponent);
|
||||||
this.formBuilder!.insertFormItem(<azdata.FormComponent>this.dataSourcesFormComponent, 2);
|
this.formBuilder!.insertFormItem(<azdata.FormComponent>this.dataSourcesFormComponent, 2);
|
||||||
this.connectionIsDataSource = true;
|
this.connectionIsDataSource = true;
|
||||||
@@ -423,7 +423,7 @@ export class PublishDatabaseDialog {
|
|||||||
this.profileSqlCmdVars = result.sqlCmdVariables;
|
this.profileSqlCmdVars = result.sqlCmdVariables;
|
||||||
const data = this.convertSqlCmdVarsToTableFormat(this.getSqlCmdVariablesForPublish());
|
const data = this.convertSqlCmdVarsToTableFormat(this.getSqlCmdVariablesForPublish());
|
||||||
|
|
||||||
(<azdata.TableComponent>this.sqlCmdVariablesTable).updateProperties({
|
await (<azdata.TableComponent>this.sqlCmdVariablesTable).updateProperties({
|
||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { BuildHelper } from '../tools/buildHelper';
|
|||||||
|
|
||||||
describe('BuildHelper: Build Helper tests', function (): void {
|
describe('BuildHelper: Build Helper tests', function (): void {
|
||||||
|
|
||||||
it('Should get correct build arguments', async function (): Promise<void> {
|
it('Should get correct build arguments', function (): void {
|
||||||
// update settings and validate
|
// update settings and validate
|
||||||
const buildHelper = new BuildHelper();
|
const buildHelper = new BuildHelper();
|
||||||
const resultArg = buildHelper.constructBuildArguments('dummy\\project path\\more space in path', 'dummy\\dll path');
|
const resultArg = buildHelper.constructBuildArguments('dummy\\project path\\more space in path', 'dummy\\dll path');
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ describe('MainController: main controller operations', function (): void {
|
|||||||
await baselines.loadBaselines();
|
await baselines.loadBaselines();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async function (): Promise<void> {
|
beforeEach(function (): void {
|
||||||
testContext.apiWrapper.reset();
|
testContext.apiWrapper.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ describe.skip('NetCoreTool: Net core tests', function (): void {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should find right dotnet default paths', async function (): Promise<void> {
|
it('Should find right dotnet default paths', function (): void {
|
||||||
const netcoreTool = new NetCoreTool();
|
const netcoreTool = new NetCoreTool();
|
||||||
netcoreTool.findOrInstallNetCore();
|
netcoreTool.findOrInstallNetCore();
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ const mockConnectionProfile: azdata.IConnectionProfile = {
|
|||||||
options: undefined as any
|
options: undefined as any
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(async function (): Promise<void> {
|
beforeEach(function (): void {
|
||||||
testContext = createContext();
|
testContext = createContext();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -247,26 +247,26 @@ describe('ProjectsController: project controller operations', function (): void
|
|||||||
|
|
||||||
let publishDialog = TypeMoq.Mock.ofType(PublishDatabaseDialog, undefined, undefined, new ApiWrapper(), proj);
|
let publishDialog = TypeMoq.Mock.ofType(PublishDatabaseDialog, undefined, undefined, new ApiWrapper(), proj);
|
||||||
publishDialog.callBase = true;
|
publishDialog.callBase = true;
|
||||||
publishDialog.setup(x => x.getConnectionUri()).returns(async () => 'fake|connection|uri');
|
publishDialog.setup(x => x.getConnectionUri()).returns(() => Promise.resolve('fake|connection|uri'));
|
||||||
|
|
||||||
let projController = TypeMoq.Mock.ofType(ProjectsController);
|
let projController = TypeMoq.Mock.ofType(ProjectsController);
|
||||||
projController.callBase = true;
|
projController.callBase = true;
|
||||||
projController.setup(x => x.getPublishDialog(TypeMoq.It.isAny())).returns(() => publishDialog.object);
|
projController.setup(x => x.getPublishDialog(TypeMoq.It.isAny())).returns(() => publishDialog.object);
|
||||||
projController.setup(x => x.executionCallback(TypeMoq.It.isAny(), TypeMoq.It.is((_): _ is IPublishSettings => true))).returns(async () => {
|
projController.setup(x => x.executionCallback(TypeMoq.It.isAny(), TypeMoq.It.is((_): _ is IPublishSettings => true))).returns(() => {
|
||||||
holler = publishHoller;
|
holler = publishHoller;
|
||||||
return undefined;
|
return Promise.resolve(undefined);
|
||||||
});
|
});
|
||||||
projController.setup(x => x.readPublishProfile(TypeMoq.It.isAny())).returns(async () => {
|
projController.setup(x => x.readPublishProfile(TypeMoq.It.isAny())).returns(() => {
|
||||||
holler = profileHoller;
|
holler = profileHoller;
|
||||||
return {
|
return Promise.resolve({
|
||||||
databaseName: '',
|
databaseName: '',
|
||||||
sqlCmdVariables: {}
|
sqlCmdVariables: {}
|
||||||
};
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
projController.setup(x => x.executionCallback(TypeMoq.It.isAny(), TypeMoq.It.is((_): _ is IGenerateScriptSettings => true))).returns(async () => {
|
projController.setup(x => x.executionCallback(TypeMoq.It.isAny(), TypeMoq.It.is((_): _ is IGenerateScriptSettings => true))).returns(() => {
|
||||||
holler = generateHoller;
|
holler = generateHoller;
|
||||||
return undefined;
|
return Promise.resolve(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
let dialog = await projController.object.publishProject(proj);
|
let dialog = await projController.object.publishProject(proj);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { ProjectRootTreeItem } from '../models/tree/projectTreeItem';
|
|||||||
import { DatabaseProjectItemType } from '../common/constants';
|
import { DatabaseProjectItemType } from '../common/constants';
|
||||||
|
|
||||||
describe.skip('Project Tree tests', function (): void {
|
describe.skip('Project Tree tests', function (): void {
|
||||||
it('Should correctly order tree nodes by type, then by name', async function (): Promise<void> {
|
it('Should correctly order tree nodes by type, then by name', function (): void {
|
||||||
const root = os.platform() === 'win32' ? 'Z:\\' : '/';
|
const root = os.platform() === 'win32' ? 'Z:\\' : '/';
|
||||||
|
|
||||||
const parent = new ProjectRootTreeItem(new Project(vscode.Uri.file(`${root}Fake.sqlproj`).fsPath));
|
const parent = new ProjectRootTreeItem(new Project(vscode.Uri.file(`${root}Fake.sqlproj`).fsPath));
|
||||||
@@ -46,7 +46,7 @@ describe.skip('Project Tree tests', function (): void {
|
|||||||
should(inputNodes.map(n => n.uri.path)).deepEqual(expectedNodes.map(n => n.uri.path));
|
should(inputNodes.map(n => n.uri.path)).deepEqual(expectedNodes.map(n => n.uri.path));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should build tree from Project file correctly', async function (): Promise<void> {
|
it('Should build tree from Project file correctly', function (): void {
|
||||||
const root = os.platform() === 'win32' ? 'Z:\\' : '/';
|
const root = os.platform() === 'win32' ? 'Z:\\' : '/';
|
||||||
const proj = new Project(vscode.Uri.file(`${root}TestProj.sqlproj`).fsPath);
|
const proj = new Project(vscode.Uri.file(`${root}TestProj.sqlproj`).fsPath);
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ describe.skip('Project Tree tests', function (): void {
|
|||||||
DatabaseProjectItemType.file]);
|
DatabaseProjectItemType.file]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to parse windows relative path as platform safe path', async function (): Promise<void> {
|
it('Should be able to parse windows relative path as platform safe path', function (): void {
|
||||||
const root = os.platform() === 'win32' ? 'Z:\\' : '/';
|
const root = os.platform() === 'win32' ? 'Z:\\' : '/';
|
||||||
const proj = new Project(vscode.Uri.file(`${root}TestProj.sqlproj`).fsPath);
|
const proj = new Project(vscode.Uri.file(`${root}TestProj.sqlproj`).fsPath);
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ describe.skip('Publish Database Dialog', () => {
|
|||||||
await baselines.loadBaselines();
|
await baselines.loadBaselines();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async function (): Promise<void> {
|
beforeEach(function (): void {
|
||||||
testContext = createContext();
|
testContext = createContext();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ describe.skip('Publish Database Dialog', () => {
|
|||||||
it('Should include all info in publish profile', async function (): Promise<void> {
|
it('Should include all info in publish profile', async function (): Promise<void> {
|
||||||
const proj = await testUtils.createTestProject(baselines.openProjectFileBaseline);
|
const proj = await testUtils.createTestProject(baselines.openProjectFileBaseline);
|
||||||
const dialog = TypeMoq.Mock.ofType(PublishDatabaseDialog, undefined, undefined, testContext.apiWrapper.object, proj);
|
const dialog = TypeMoq.Mock.ofType(PublishDatabaseDialog, undefined, undefined, testContext.apiWrapper.object, proj);
|
||||||
dialog.setup(x => x.getConnectionUri()).returns(async () => { return 'Mock|Connection|Uri'; });
|
dialog.setup(x => x.getConnectionUri()).returns(() => { return Promise.resolve('Mock|Connection|Uri'); });
|
||||||
dialog.setup(x => x.getTargetDatabaseName()).returns(() => 'MockDatabaseName');
|
dialog.setup(x => x.getTargetDatabaseName()).returns(() => 'MockDatabaseName');
|
||||||
dialog.callBase = true;
|
dialog.callBase = true;
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ describe.skip('Publish Database Dialog', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
dialog.object.publish = async (_, prof) => { profile = prof; };
|
dialog.object.publish = (_, prof) => { profile = prof; };
|
||||||
await dialog.object.publishClick();
|
await dialog.object.publishClick();
|
||||||
|
|
||||||
should(profile).deepEqual(expectedPublish);
|
should(profile).deepEqual(expectedPublish);
|
||||||
@@ -88,7 +88,7 @@ describe.skip('Publish Database Dialog', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
dialog.object.generateScript = async (_, prof) => { profile = prof; };
|
dialog.object.generateScript = (_, prof) => { profile = prof; };
|
||||||
await dialog.object.generateScriptClick();
|
await dialog.object.generateScriptClick();
|
||||||
|
|
||||||
should(profile).deepEqual(expectedGenScript);
|
should(profile).deepEqual(expectedGenScript);
|
||||||
|
|||||||
Reference in New Issue
Block a user