mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Schema Compare tests for utils (#10759)
* Added a few tests for utils file under Schema Compare * Addressed comment- moved mock test data to a common location
This commit is contained in:
@@ -12,47 +12,12 @@ import 'mocha';
|
||||
import { SchemaCompareDialog } from './../dialogs/schemaCompareDialog';
|
||||
import { SchemaCompareMainWindow } from '../schemaCompareMainWindow';
|
||||
import { SchemaCompareTestService } from './testSchemaCompareService';
|
||||
import { mockConnectionProfile, mockDacpacEndpoint } from './testUtils';
|
||||
|
||||
// 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: mssql.SchemaCompareEndpointInfo = {
|
||||
endpointType: mssql.SchemaCompareEndpointType.Dacpac,
|
||||
serverDisplayName: '',
|
||||
serverName: '',
|
||||
databaseName: '',
|
||||
ownerUri: '',
|
||||
packageFilePath: mocksource,
|
||||
connectionDetails: undefined
|
||||
};
|
||||
|
||||
const mockTargetEndpoint: mssql.SchemaCompareEndpointInfo = {
|
||||
endpointType: mssql.SchemaCompareEndpointType.Dacpac,
|
||||
serverDisplayName: '',
|
||||
serverName: '',
|
||||
databaseName: '',
|
||||
ownerUri: '',
|
||||
packageFilePath: mocktarget,
|
||||
connectionDetails: undefined
|
||||
};
|
||||
|
||||
let mockExtensionContext: TypeMoq.IMock<vscode.ExtensionContext>;
|
||||
|
||||
describe('SchemaCompareDialog.openDialog', function (): void {
|
||||
@@ -86,8 +51,13 @@ describe('SchemaCompareResult.start', function (): void {
|
||||
await promise;
|
||||
|
||||
should(result.getComparisonResult() === undefined);
|
||||
result.sourceEndpointInfo = mockSourceEndpoint;
|
||||
result.targetEndpointInfo = mockTargetEndpoint;
|
||||
|
||||
let sourceEndpointInfo : mssql.SchemaCompareEndpointInfo = {...mockDacpacEndpoint};
|
||||
let targetEndpointInfo : mssql.SchemaCompareEndpointInfo = {...mockDacpacEndpoint};
|
||||
result.sourceEndpointInfo = sourceEndpointInfo;
|
||||
result.sourceEndpointInfo.packageFilePath = mocksource;
|
||||
result.targetEndpointInfo = targetEndpointInfo;
|
||||
result.targetEndpointInfo.packageFilePath = mocktarget;
|
||||
await result.execute();
|
||||
|
||||
should(result.getComparisonResult() !== undefined);
|
||||
|
||||
Reference in New Issue
Block a user