mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 01:25:38 -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:
@@ -11,7 +11,7 @@ import { BuildHelper } from '../tools/buildHelper';
|
||||
|
||||
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
|
||||
const buildHelper = new BuildHelper();
|
||||
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();
|
||||
});
|
||||
|
||||
beforeEach(async function (): Promise<void> {
|
||||
beforeEach(function (): void {
|
||||
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();
|
||||
netcoreTool.findOrInstallNetCore();
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ const mockConnectionProfile: azdata.IConnectionProfile = {
|
||||
options: undefined as any
|
||||
};
|
||||
|
||||
beforeEach(async function (): Promise<void> {
|
||||
beforeEach(function (): void {
|
||||
testContext = createContext();
|
||||
});
|
||||
|
||||
@@ -247,26 +247,26 @@ describe('ProjectsController: project controller operations', function (): void
|
||||
|
||||
let publishDialog = TypeMoq.Mock.ofType(PublishDatabaseDialog, undefined, undefined, new ApiWrapper(), proj);
|
||||
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);
|
||||
projController.callBase = true;
|
||||
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;
|
||||
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;
|
||||
return {
|
||||
databaseName: '',
|
||||
sqlCmdVariables: {}
|
||||
};
|
||||
return Promise.resolve({
|
||||
databaseName: '',
|
||||
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;
|
||||
return undefined;
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
|
||||
let dialog = await projController.object.publishProject(proj);
|
||||
|
||||
@@ -14,7 +14,7 @@ import { ProjectRootTreeItem } from '../models/tree/projectTreeItem';
|
||||
import { DatabaseProjectItemType } from '../common/constants';
|
||||
|
||||
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 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));
|
||||
});
|
||||
|
||||
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 proj = new Project(vscode.Uri.file(`${root}TestProj.sqlproj`).fsPath);
|
||||
|
||||
@@ -94,7 +94,7 @@ describe.skip('Project Tree tests', function (): void {
|
||||
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 proj = new Project(vscode.Uri.file(`${root}TestProj.sqlproj`).fsPath);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ describe.skip('Publish Database Dialog', () => {
|
||||
await baselines.loadBaselines();
|
||||
});
|
||||
|
||||
beforeEach(async function (): Promise<void> {
|
||||
beforeEach(function (): void {
|
||||
testContext = createContext();
|
||||
});
|
||||
|
||||
@@ -58,7 +58,7 @@ describe.skip('Publish Database Dialog', () => {
|
||||
it('Should include all info in publish profile', async function (): Promise<void> {
|
||||
const proj = await testUtils.createTestProject(baselines.openProjectFileBaseline);
|
||||
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.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();
|
||||
|
||||
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();
|
||||
|
||||
should(profile).deepEqual(expectedGenScript);
|
||||
|
||||
Reference in New Issue
Block a user