mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-14 18:46:34 -05:00
Schema Compare test coverage (#11042)
* Few tests for Schema Compare * Addressed comment- removed wait in test * Split setEndpointInfo for database and dacpac
This commit is contained in:
@@ -9,6 +9,16 @@ import * as mssql from '../../../mssql';
|
||||
export class SchemaCompareTestService implements mssql.ISchemaCompareService {
|
||||
|
||||
testOperationId: string = 'Test Operation Id';
|
||||
testState: testStateScmp;
|
||||
|
||||
constructor(state?: testStateScmp) {
|
||||
if (state) {
|
||||
this.testState = state;
|
||||
}
|
||||
else {
|
||||
this.testState = testStateScmp.SUCCESS_EQUAL;
|
||||
}
|
||||
}
|
||||
|
||||
schemaComparePublishChanges(operationId: string, targetServerName: string, targetDatabaseName: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.ResultStatus> {
|
||||
throw new Error('Method not implemented.');
|
||||
@@ -38,13 +48,56 @@ export class SchemaCompareTestService implements mssql.ISchemaCompareService {
|
||||
}
|
||||
|
||||
schemaCompare(operationId: string, sourceEndpointInfo: mssql.SchemaCompareEndpointInfo, targetEndpointInfo: mssql.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode): Thenable<mssql.SchemaCompareResult> {
|
||||
let result: mssql.SchemaCompareResult = {
|
||||
operationId: this.testOperationId,
|
||||
areEqual: true,
|
||||
differences: [],
|
||||
success: true,
|
||||
errorMessage: ''
|
||||
};
|
||||
let result: mssql.SchemaCompareResult;
|
||||
if (this.testState === testStateScmp.FAILURE) {
|
||||
result = {
|
||||
operationId: this.testOperationId,
|
||||
areEqual: false,
|
||||
differences: [],
|
||||
success: false,
|
||||
errorMessage: 'Test failure'
|
||||
};
|
||||
}
|
||||
else if (this.testState === testStateScmp.SUCCESS_NOT_EQUAL) {
|
||||
result = {
|
||||
operationId: this.testOperationId,
|
||||
areEqual: false,
|
||||
differences: [{
|
||||
updateAction: 2,
|
||||
differenceType: 0,
|
||||
name: 'SqlTable',
|
||||
sourceValue: ['dbo', 'table1'],
|
||||
targetValue: null,
|
||||
parent: null,
|
||||
children: [{
|
||||
updateAction: 2,
|
||||
differenceType: 0,
|
||||
name: 'SqlSimpleColumn',
|
||||
sourceValue: ['dbo', 'table1', 'id'],
|
||||
targetValue: null,
|
||||
parent: null,
|
||||
children: [],
|
||||
sourceScript: '',
|
||||
targetScript: null,
|
||||
included: false
|
||||
}],
|
||||
sourceScript: 'CREATE TABLE [dbo].[table1](id int)',
|
||||
targetScript: null,
|
||||
included: true
|
||||
}],
|
||||
success: true,
|
||||
errorMessage: ''
|
||||
};
|
||||
}
|
||||
else {
|
||||
result = {
|
||||
operationId: this.testOperationId,
|
||||
areEqual: true,
|
||||
differences: [],
|
||||
success: true,
|
||||
errorMessage: null
|
||||
};
|
||||
}
|
||||
|
||||
return Promise.resolve(result);
|
||||
}
|
||||
@@ -63,3 +116,9 @@ export class SchemaCompareTestService implements mssql.ISchemaCompareService {
|
||||
registerOnUpdated(handler: () => any): void {
|
||||
}
|
||||
}
|
||||
|
||||
export enum testStateScmp {
|
||||
SUCCESS_EQUAL,
|
||||
SUCCESS_NOT_EQUAL,
|
||||
FAILURE
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user