SQL DB Project Extension - Providing publish deploy options (#17993)

* initilaizing the sqlproj display options work

* added more code to the options dialog, need default option values

* Except REset Button, all works and need to refactor and test

* DisplayOptions for SQL DB Proj completed, refactor needed

* Tests for display options

* refactor code and removed unnecessary await calls

* Description values getting from STS API and code refactor

* DacpacExtesnion test model error fix

* updates related to STS model updates

* Dac Deployement options model updates according to STS changes

* Undoing file updates and moving as separate PR

* Undoing vscode whitespace changes which were added accidentally

* Options display name coming from API

* Updated model with dac deploy options display names coming from the STS API

* errors fixed after merge to main

* separating model related changes after merge, separate PR exists

* wrong Comment for the test case removed

* code refactor updates

* Hyperlink changes to secondary button and style updates

* refactoring code and comments

* importing type only instead of whole azdata and comment updates

* projectcontroller test fix

* removed duplicate file updates from other PR

* code refactor according to comments

* Added dispose to the onclick handler

* Added test case

* parameter change results error and fixed

* Addressing all comments with updates

* Unused variable removed and missed with previous commit

* Updated the ppublish button and width

* Adjusted the database dropdown and options margins to make all input align in same line

* Updated the database width and moved stylings to uiconstants file
This commit is contained in:
Sai Avishkar Sreerama
2022-06-06 16:53:53 -05:00
committed by GitHub
parent 0b89272739
commit e08a87d035
8 changed files with 569 additions and 11 deletions

View File

@@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as should from 'should';
import * as testUtils from '../testUtils';
import * as testData from '../testContext';
import * as baselines from '../baselines/baselines';
import * as TypeMoq from 'typemoq';
import { PublishOptionsDialog } from '../../dialogs/publishOptionsDialog';
import { PublishDatabaseDialog } from '../../dialogs/publishDatabaseDialog';
import { Project } from '../../models/project';
describe('Publish Database Options Dialog', () => {
before(async function (): Promise<void> {
await baselines.loadBaselines();
});
it('Should open dialog successfully ', async function (): Promise<void> {
const publishDatabaseDialog = new PublishDatabaseDialog(new Project(''));
const optionsDialog = new PublishOptionsDialog(testData.getDeploymentOptions(), publishDatabaseDialog);
optionsDialog.openDialog();
// Verify the dialog should exists
should.notEqual(optionsDialog.dialog, undefined);
});
it('Should deployment options gets initialized correctly with sample test project', async function (): Promise<void> {
// Create new sample test project
const project = await testUtils.createTestProject(baselines.openProjectFileBaseline);
const dialog = TypeMoq.Mock.ofType(PublishDatabaseDialog, undefined, undefined, project);
dialog.setup(x => x.getDeploymentOptions()).returns(() => { return Promise.resolve(testData.mockDacFxOptionsResult.deploymentOptions); });
const options = await dialog.object.getDeploymentOptions();
const optionsDialog = new PublishOptionsDialog(options, new PublishDatabaseDialog(project));
// Verify the options model should exists
should.notEqual(optionsDialog.optionsModel, undefined);
// Verify the deployment options should exists
should.notEqual(optionsDialog.optionsModel.deploymentOptions, undefined);
Object.entries(optionsDialog.optionsModel.deploymentOptions).forEach(option => {
// Validate the value and description as expected
should.equal(option[1].value, false);
should.equal(option[1].description, 'Sample Description text');
});
});
});