Schema Compare tests addition (#5136)

* initial tests for schema compare

* Adding schema compare integration test

* Adding code to fix some build issues

* DB compare test

* Adding some CR comments

* db creation and deletion as per CR comments
This commit is contained in:
udeeshagautam
2019-05-21 11:17:52 -07:00
committed by GitHub
parent c84367e2ee
commit 3fc2ad5bc9
12 changed files with 652 additions and 4 deletions

View File

@@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as should from 'should';
import * as TypeMoq from 'typemoq';
import * as vscode from 'vscode';
import * as azdata from 'azdata';
import 'mocha';
import { SchemaCompareDialog } from './../dialogs/schemaCompareDialog';
import { SchemaCompareResult } from './../schemaCompareResult';
import { SchemaCompareTestService } from './testSchemaCompareService';
// Mock test data
const mockConnectionProfile: azdata.IConnectionProfile = {
connectionName: 'My Connection',
serverName: 'My Server',
databaseName: 'My Server',
userName: 'My User',
password: 'My Pwd',
authenticationType: 'SqlLogin',
savePassword: false,
groupFullName: 'My groupName',
groupId: 'My GroupId',
providerName: 'My Server',
saveProfile: true,
id: 'My Id',
options: null
};
const mocksource: string = 'source.dacpac';
const mocktarget: string = 'target.dacpac';
const mockSourceEndpoint: azdata.SchemaCompareEndpointInfo = {
endpointType: azdata.SchemaCompareEndpointType.Dacpac,
serverName: '',
databaseName: '',
ownerUri: '',
packageFilePath: mocksource
};
const mockTargetEndpoint: azdata.SchemaCompareEndpointInfo = {
endpointType: azdata.SchemaCompareEndpointType.Dacpac,
serverName: '',
databaseName: '',
ownerUri: '',
packageFilePath: mocktarget
};
describe('SchemaCompareDialog.openDialog', function(): void {
it('Should be correct when created.', function(): void {
let dialog = new SchemaCompareDialog();
dialog.openDialog(mockConnectionProfile);
should(dialog.dialog.title).equal('Schema Compare');
should(dialog.dialog.okButton.label).equal('Compare');
should(dialog.dialog.okButton.enabled).equal(true);
});
});
describe('SchemaCompareResult.start', function(): void {
it('Should be correct when created.', async function(): Promise<void> {
let sc = new SchemaCompareTestService();
azdata.dataprotocol.registerSchemaCompareServicesProvider(sc);
let result = new SchemaCompareResult(mocksource, mocktarget, mockSourceEndpoint, mockTargetEndpoint);
let promise = new Promise(resolve => setTimeout(resolve, 3000)); // to ensure comparision result view is initialized
await promise;
await result.start();
should(result.getComparisionResult().success).equal(true);
should(result.getComparisionResult().operationId).equal(sc.testOperationId);
});
});