Apply changes from remote database to sqlproj - schema-compare changes (#17679)

* update project from database

* update project from database

* Merge from main

* Removing dupe test stub

* PR feedback

* cleanup

* PR feedback

* Fixing tests, adding stubs to update sqlproj as schema compare target

* updating code comment

Co-authored-by: Noureldine Yehia <t-nyehia@microsoft.com>
This commit is contained in:
Benjin Dubishar
2021-11-22 10:50:36 -08:00
committed by GitHub
parent 0caa6390b9
commit 1f98f29eae
7 changed files with 507 additions and 131 deletions

View File

@@ -110,7 +110,7 @@ describe('SchemaCompareMainWindow.results @DacFx@', function (): void {
it('Should show error if publish changes fails', async function (): Promise<void> {
let service = createServiceMock();
service.setup(x => x.schemaComparePublishChanges(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve({
service.setup(x => x.schemaComparePublishDatabaseChanges(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve({
success: false,
errorMessage: 'error1'
}));
@@ -121,7 +121,7 @@ describe('SchemaCompareMainWindow.results @DacFx@', function (): void {
await schemaCompareResult.start(undefined);
schemaCompareResult.sourceEndpointInfo = setDacpacEndpointInfo(mocksource);
schemaCompareResult.targetEndpointInfo = setDacpacEndpointInfo(mocktarget);
schemaCompareResult.targetEndpointInfo = setDatabaseEndpointInfo();
await schemaCompareResult.execute();
await schemaCompareResult.publishChanges();
@@ -131,7 +131,7 @@ describe('SchemaCompareMainWindow.results @DacFx@', function (): void {
it('Should show not error if publish changes succeed', async function (): Promise<void> {
let service = createServiceMock();
service.setup(x => x.schemaComparePublishChanges(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve({
service.setup(x => x.schemaComparePublishDatabaseChanges(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve({
success: true,
errorMessage: ''
}));
@@ -140,7 +140,7 @@ describe('SchemaCompareMainWindow.results @DacFx@', function (): void {
await schemaCompareResult.start(undefined);
schemaCompareResult.sourceEndpointInfo = setDacpacEndpointInfo(mocksource);
schemaCompareResult.targetEndpointInfo = setDacpacEndpointInfo(mocktarget);
schemaCompareResult.targetEndpointInfo = setDatabaseEndpointInfo();
await schemaCompareResult.execute();
await schemaCompareResult.publishChanges();
should(showErrorMessageSpy.notCalled).be.true();
@@ -343,7 +343,7 @@ describe('SchemaCompareMainWindow.results @DacFx@', function (): void {
it('Should not show error if user does not want to publish', async function (): Promise<void> {
let service = createServiceMock();
service.setup(x => x.schemaComparePublishChanges(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve({
service.setup(x => x.schemaComparePublishDatabaseChanges(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve({
success: true,
errorMessage: ''
}));

View File

@@ -98,7 +98,7 @@ export const mockDacpacEndpoint: mssql.SchemaCompareEndpointInfo = {
projectFilePath: '',
folderStructure: '',
targetScripts: [],
dataSchemaProvider: ''
dataSchemaProvider: '',
};
export const mockDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = {
@@ -112,7 +112,7 @@ export const mockDatabaseEndpoint: mssql.SchemaCompareEndpointInfo = {
projectFilePath: '',
folderStructure: '',
targetScripts: [],
dataSchemaProvider: ''
dataSchemaProvider: '',
};
export async function shouldThrowSpecificError(block: Function, expectedMessage: string, details?: string) {