mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Refactor schema compare options and add tests (#11414)
* refactor to make testing options easier * some cleanup * remove async * get file to 100% coverage * address a couple comments
This commit is contained in:
File diff suppressed because it is too large
Load Diff
1381
extensions/schema-compare/src/models/schemaCompareOptionsModel.ts
Normal file
1381
extensions/schema-compare/src/models/schemaCompareOptionsModel.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* 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 {SchemaCompareOptionsDialog} from '../../dialogs/schemaCompareOptionsDialog';
|
||||||
|
|
||||||
|
describe('Schema Compare Options Dialog', () => {
|
||||||
|
it('Should open dialog successfully ', async function (): Promise<void> {
|
||||||
|
const optionsDialog = new SchemaCompareOptionsDialog(undefined, undefined);
|
||||||
|
await optionsDialog.openDialog();
|
||||||
|
should.notEqual(optionsDialog.dialog, undefined);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* 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 mssql from '../../../../mssql/src/mssql';
|
||||||
|
import {SchemaCompareOptionsModel} from '../../models/schemaCompareOptionsModel';
|
||||||
|
|
||||||
|
describe('Schema Compare Options Model', () => {
|
||||||
|
it('Should create model and set options successfully', function (): void {
|
||||||
|
const model = new SchemaCompareOptionsModel(defaultOptions);
|
||||||
|
should.notEqual(model.getOptionsData(), undefined, "Options shouldn't be undefined");
|
||||||
|
should.notEqual(model.getObjectsData(), undefined, "Objects shouldn't be udnefined");
|
||||||
|
|
||||||
|
should.doesNotThrow(() => model.setDeploymentOptions());
|
||||||
|
should.doesNotThrow(() => model.setObjectTypeOptions());
|
||||||
|
|
||||||
|
should(model.getSchemaCompareOptionUtil('')).be.false("Should return false if an invalid option is passed in");
|
||||||
|
should(model.getSchemaCompareIncludedObjectsUtil('')).be.false("Should return false if invalid object name is passed in");
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should exclude objects', function (): void {
|
||||||
|
const model = new SchemaCompareOptionsModel(defaultOptions);
|
||||||
|
should(model.excludedObjectTypes.length).be.equal(0, "There shuld be no excluded objects");
|
||||||
|
|
||||||
|
model.objectTypeLabels.forEach(l => {
|
||||||
|
model.setSchemaCompareIncludedObjectsUtil(l, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
should(model.excludedObjectTypes.length).be.equal(model.objectTypeLabels.length, "All the object types should be excluded");
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should get descriptions', function (): void {
|
||||||
|
const model = new SchemaCompareOptionsModel(defaultOptions);
|
||||||
|
model.optionsLabels.forEach(l => {
|
||||||
|
should(model.getDescription(l)).not.equal(undefined);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const defaultOptions: mssql.DeploymentOptions = {
|
||||||
|
ignoreTableOptions: false,
|
||||||
|
ignoreSemicolonBetweenStatements: false,
|
||||||
|
ignoreRouteLifetime: false,
|
||||||
|
ignoreRoleMembership: false,
|
||||||
|
ignoreQuotedIdentifiers: false,
|
||||||
|
ignorePermissions: false,
|
||||||
|
ignorePartitionSchemes: false,
|
||||||
|
ignoreObjectPlacementOnPartitionScheme: false,
|
||||||
|
ignoreNotForReplication: false,
|
||||||
|
ignoreLoginSids: false,
|
||||||
|
ignoreLockHintsOnIndexes: false,
|
||||||
|
ignoreKeywordCasing: false,
|
||||||
|
ignoreIndexPadding: false,
|
||||||
|
ignoreIndexOptions: false,
|
||||||
|
ignoreIncrement: false,
|
||||||
|
ignoreIdentitySeed: false,
|
||||||
|
ignoreUserSettingsObjects: false,
|
||||||
|
ignoreFullTextCatalogFilePath: false,
|
||||||
|
ignoreWhitespace: false,
|
||||||
|
ignoreWithNocheckOnForeignKeys: false,
|
||||||
|
verifyCollationCompatibility: false,
|
||||||
|
unmodifiableObjectWarnings: false,
|
||||||
|
treatVerificationErrorsAsWarnings: false,
|
||||||
|
scriptRefreshModule: false,
|
||||||
|
scriptNewConstraintValidation: false,
|
||||||
|
scriptFileSize: false,
|
||||||
|
scriptDeployStateChecks: false,
|
||||||
|
scriptDatabaseOptions: false,
|
||||||
|
scriptDatabaseCompatibility: false,
|
||||||
|
scriptDatabaseCollation: false,
|
||||||
|
runDeploymentPlanExecutors: false,
|
||||||
|
registerDataTierApplication: false,
|
||||||
|
populateFilesOnFileGroups: false,
|
||||||
|
noAlterStatementsToChangeClrTypes: false,
|
||||||
|
includeTransactionalScripts: false,
|
||||||
|
includeCompositeObjects: false,
|
||||||
|
allowUnsafeRowLevelSecurityDataMovement: false,
|
||||||
|
ignoreWithNocheckOnCheckConstraints: false,
|
||||||
|
ignoreFillFactor: false,
|
||||||
|
ignoreFileSize: false,
|
||||||
|
ignoreFilegroupPlacement: false,
|
||||||
|
doNotAlterReplicatedObjects: false,
|
||||||
|
doNotAlterChangeDataCaptureObjects: false,
|
||||||
|
disableAndReenableDdlTriggers: false,
|
||||||
|
deployDatabaseInSingleUserMode: false,
|
||||||
|
createNewDatabase: false,
|
||||||
|
compareUsingTargetCollation: false,
|
||||||
|
commentOutSetVarDeclarations: false,
|
||||||
|
blockWhenDriftDetected: false,
|
||||||
|
blockOnPossibleDataLoss: false,
|
||||||
|
backupDatabaseBeforeChanges: false,
|
||||||
|
allowIncompatiblePlatform: false,
|
||||||
|
allowDropBlockingAssemblies: false,
|
||||||
|
dropConstraintsNotInSource: false,
|
||||||
|
dropDmlTriggersNotInSource: false,
|
||||||
|
dropExtendedPropertiesNotInSource: false,
|
||||||
|
dropIndexesNotInSource: false,
|
||||||
|
ignoreFileAndLogFilePath: false,
|
||||||
|
ignoreExtendedProperties: false,
|
||||||
|
ignoreDmlTriggerState: false,
|
||||||
|
ignoreDmlTriggerOrder: false,
|
||||||
|
ignoreDefaultSchema: false,
|
||||||
|
ignoreDdlTriggerState: false,
|
||||||
|
ignoreDdlTriggerOrder: false,
|
||||||
|
ignoreCryptographicProviderFilePath: false,
|
||||||
|
verifyDeployment: false,
|
||||||
|
ignoreComments: false,
|
||||||
|
ignoreColumnCollation: false,
|
||||||
|
ignoreAuthorizer: false,
|
||||||
|
ignoreAnsiNulls: false,
|
||||||
|
generateSmartDefaults: false,
|
||||||
|
dropStatisticsNotInSource: false,
|
||||||
|
dropRoleMembersNotInSource: false,
|
||||||
|
dropPermissionsNotInSource: false,
|
||||||
|
dropObjectsNotInSource: false,
|
||||||
|
ignoreColumnOrder: false,
|
||||||
|
doNotDropObjectTypes: [],
|
||||||
|
excludeObjectTypes: [mssql.SchemaObjectType.Tables]
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user