mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Schema Compare cleanup (#11418)
* cleanup async and await stuff * remove awaits * remove more awaits
This commit is contained in:
@@ -24,9 +24,10 @@ const mocktarget: string = 'target.dacpac';
|
||||
let mockExtensionContext: TypeMoq.IMock<vscode.ExtensionContext>;
|
||||
let testContext: TestContext;
|
||||
|
||||
before(async function (): Promise<void> {
|
||||
before(function (): void {
|
||||
testContext = createContext();
|
||||
});
|
||||
|
||||
describe('SchemaCompareDialog.openDialog', function (): void {
|
||||
before(() => {
|
||||
mockExtensionContext = TypeMoq.Mock.ofType<vscode.ExtensionContext>();
|
||||
@@ -57,8 +58,8 @@ describe('SchemaCompareMainWindow.start', function (): void {
|
||||
|
||||
should(result.getComparisonResult() === undefined);
|
||||
|
||||
result.sourceEndpointInfo = await setDacpacEndpointInfo(mocksource);
|
||||
result.targetEndpointInfo = await setDacpacEndpointInfo(mocktarget);
|
||||
result.sourceEndpointInfo = setDacpacEndpointInfo(mocksource);
|
||||
result.targetEndpointInfo = setDacpacEndpointInfo(mocktarget);
|
||||
await result.execute();
|
||||
|
||||
should(result.getComparisonResult() !== undefined);
|
||||
@@ -109,7 +110,7 @@ describe('SchemaCompareMainWindow.execute', function (): void {
|
||||
testContext = createContext();
|
||||
});
|
||||
|
||||
beforeEach(async function (): Promise<void> {
|
||||
beforeEach(function (): void {
|
||||
testContext.apiWrapper.reset();
|
||||
});
|
||||
|
||||
@@ -123,8 +124,8 @@ describe('SchemaCompareMainWindow.execute', function (): void {
|
||||
|
||||
should(result.getComparisonResult() === undefined);
|
||||
|
||||
result.sourceEndpointInfo = await setDacpacEndpointInfo(mocksource);
|
||||
result.targetEndpointInfo = await setDacpacEndpointInfo(mocktarget);
|
||||
result.sourceEndpointInfo = setDacpacEndpointInfo(mocksource);
|
||||
result.targetEndpointInfo = setDacpacEndpointInfo(mocktarget);
|
||||
|
||||
await shouldThrowSpecificError(async () => await result.execute(), loc.compareErrorMessage('Test failure'));
|
||||
});
|
||||
@@ -139,8 +140,8 @@ describe('SchemaCompareMainWindow.execute', function (): void {
|
||||
|
||||
should(result.getComparisonResult() === undefined);
|
||||
|
||||
result.sourceEndpointInfo = await setDacpacEndpointInfo(mocksource);
|
||||
result.targetEndpointInfo = await setDacpacEndpointInfo(mocktarget);
|
||||
result.sourceEndpointInfo = setDacpacEndpointInfo(mocksource);
|
||||
result.targetEndpointInfo = setDacpacEndpointInfo(mocktarget);
|
||||
|
||||
await result.execute();
|
||||
testContext.apiWrapper.verify(x => x.showErrorMessage(TypeMoq.It.isAny()), TypeMoq.Times.once());
|
||||
@@ -155,8 +156,8 @@ describe('SchemaCompareMainWindow.execute', function (): void {
|
||||
|
||||
should(result.getComparisonResult() === undefined);
|
||||
|
||||
result.sourceEndpointInfo = await setDacpacEndpointInfo(mocksource);
|
||||
result.targetEndpointInfo = await setDacpacEndpointInfo(mocktarget);
|
||||
result.sourceEndpointInfo = setDacpacEndpointInfo(mocksource);
|
||||
result.targetEndpointInfo = setDacpacEndpointInfo(mocktarget);
|
||||
|
||||
await result.execute();
|
||||
|
||||
@@ -176,8 +177,8 @@ describe('SchemaCompareMainWindow.execute', function (): void {
|
||||
|
||||
should(result.getComparisonResult() === undefined);
|
||||
|
||||
result.sourceEndpointInfo = await setDacpacEndpointInfo(mocksource);
|
||||
result.targetEndpointInfo = await setDatabaseEndpointInfo();
|
||||
result.sourceEndpointInfo = setDacpacEndpointInfo(mocksource);
|
||||
result.targetEndpointInfo = setDatabaseEndpointInfo();
|
||||
|
||||
await result.execute();
|
||||
|
||||
@@ -229,7 +230,7 @@ describe('SchemaCompareMainWindow.updateSourceAndTarget', function (): void {
|
||||
should(result.getComparisonResult() === undefined);
|
||||
|
||||
result.sourceEndpointInfo = {...endpointInfo};
|
||||
result.targetEndpointInfo = await setDacpacEndpointInfo(mocktarget);
|
||||
result.targetEndpointInfo = setDacpacEndpointInfo(mocktarget);
|
||||
|
||||
result.updateSourceAndTarget();
|
||||
|
||||
@@ -249,8 +250,8 @@ describe('SchemaCompareMainWindow.updateSourceAndTarget', function (): void {
|
||||
|
||||
should(result.getComparisonResult() === undefined);
|
||||
|
||||
result.sourceEndpointInfo = await setDacpacEndpointInfo(mocksource);
|
||||
result.targetEndpointInfo = await setDacpacEndpointInfo(mocktarget);
|
||||
result.sourceEndpointInfo = setDacpacEndpointInfo(mocksource);
|
||||
result.targetEndpointInfo = setDacpacEndpointInfo(mocktarget);
|
||||
|
||||
result.updateSourceAndTarget();
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ export async function shouldThrowSpecificError(block: Function, expectedMessage:
|
||||
}
|
||||
}
|
||||
|
||||
export async function setDacpacEndpointInfo(path: string): Promise<mssql.SchemaCompareEndpointInfo> {
|
||||
export function setDacpacEndpointInfo(path: string): mssql.SchemaCompareEndpointInfo {
|
||||
let endpointInfo: mssql.SchemaCompareEndpointInfo;
|
||||
|
||||
endpointInfo = { ...mockDacpacEndpoint };
|
||||
@@ -109,7 +109,7 @@ export async function setDacpacEndpointInfo(path: string): Promise<mssql.SchemaC
|
||||
return endpointInfo;
|
||||
}
|
||||
|
||||
export async function setDatabaseEndpointInfo(): Promise<mssql.SchemaCompareEndpointInfo> {
|
||||
export function setDatabaseEndpointInfo(): mssql.SchemaCompareEndpointInfo {
|
||||
let endpointInfo: mssql.SchemaCompareEndpointInfo;
|
||||
let dbName = 'My Database';
|
||||
let serverName = 'My Server';
|
||||
|
||||
@@ -15,7 +15,7 @@ import { createContext, TestContext } from './testContext';
|
||||
let testContext: TestContext;
|
||||
|
||||
describe('utils: Tests to verify getEndpointName', function (): void {
|
||||
it('Should generate correct endpoint information', async () => {
|
||||
it('Should generate correct endpoint information', () => {
|
||||
let endpointInfo: mssql.SchemaCompareEndpointInfo;
|
||||
|
||||
should(getEndpointName(endpointInfo)).equal(' ');
|
||||
@@ -23,14 +23,14 @@ describe('utils: Tests to verify getEndpointName', function (): void {
|
||||
should(getEndpointName(mockDatabaseEndpoint)).equal(' ');
|
||||
});
|
||||
|
||||
it('Should get endpoint information from ConnectionInfo', async () => {
|
||||
it('Should get endpoint information from ConnectionInfo', () => {
|
||||
let testDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = {...mockDatabaseEndpoint};
|
||||
testDatabaseEndpoint.connectionDetails = {...mockConnectionInfo};
|
||||
|
||||
should(getEndpointName(testDatabaseEndpoint)).equal('My Server.My Database');
|
||||
});
|
||||
|
||||
it('Should get correct endpoint information from SchemaCompareEndpointInfo', async () => {
|
||||
it('Should get correct endpoint information from SchemaCompareEndpointInfo', () => {
|
||||
let dbName = 'My Database';
|
||||
let serverName = 'My Server';
|
||||
let testDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = {...mockDatabaseEndpoint};
|
||||
@@ -42,7 +42,7 @@ describe('utils: Tests to verify getEndpointName', function (): void {
|
||||
});
|
||||
|
||||
describe('utils: Basic tests to verify verifyConnectionAndGetOwnerUri', function (): void {
|
||||
before(async function (): Promise<void> {
|
||||
before(function (): void {
|
||||
testContext = createContext();
|
||||
});
|
||||
|
||||
@@ -65,7 +65,7 @@ describe('utils: Basic tests to verify verifyConnectionAndGetOwnerUri', function
|
||||
});
|
||||
|
||||
describe('utils: In-depth tests to verify verifyConnectionAndGetOwnerUri', function (): void {
|
||||
before(async function (): Promise<void> {
|
||||
before(function (): void {
|
||||
testContext = createContext();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user