mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Include Object Types logic refactored and options fetching from DacFx (#20031)
* Include Object Types logic refactored and options fetching from DacFx * Removed localized object types constants * Prop name updated and references and tests updated * updated comments * STS vBump * updating the test file to pass the PR Validations
This commit is contained in:
committed by
GitHub
parent
2b5d2f0a0b
commit
54d4098f85
@@ -11,30 +11,42 @@ describe('Schema Compare Options Model', () => {
|
||||
it('Should create model and set options successfully', function (): void {
|
||||
const model = new SchemaCompareOptionsModel(testUtils.getDeploymentOptions());
|
||||
should.notEqual(model.getOptionsData(), undefined, 'Options shouldn\'t be undefined');
|
||||
should.notEqual(model.getObjectsData(), undefined, 'Objects shouldn\'t be undefined');
|
||||
should.notEqual(model.getIncludeObjectTypesOptionsData(), undefined, 'Objects shouldn\'t be undefined');
|
||||
|
||||
should.doesNotThrow(() => model.setDeploymentOptions());
|
||||
should.doesNotThrow(() => model.setObjectTypeOptions());
|
||||
|
||||
should(model.getSchemaCompareIncludedObjectsUtil('')).be.false('Should return false if invalid object name is passed in');
|
||||
should.doesNotThrow(() => model.setIncludeObjectTypesToDeploymentOptions());
|
||||
});
|
||||
|
||||
it('Should exclude objects', function (): void {
|
||||
it('Should not have a default object types to exclude from IncludeObjectTypes ', function (): void {
|
||||
const model = new SchemaCompareOptionsModel(testUtils.getDeploymentOptions());
|
||||
should(model.excludedObjectTypes.length).be.equal(0, 'There should be no excluded objects');
|
||||
should(model.deploymentOptions.excludeObjectTypes.value.length).be.equal(0, 'There should be no object type excluded from IncludeObjectTypes');
|
||||
|
||||
model.objectTypeLabels.forEach(label => {
|
||||
model.setSchemaCompareIncludedObjectsUtil(label, false);
|
||||
Object.keys(model.deploymentOptions.objectTypesDictionary).forEach(option => {
|
||||
should(model.getIncludeObjectTypeOptionCheckStatus(option)).equal(true, 'Object types that are not excluded should return true');
|
||||
});
|
||||
});
|
||||
|
||||
should(model.excludedObjectTypes.length).be.equal(model.objectTypeLabels.length, 'All the object types should be excluded');
|
||||
it('Should have default object types to exclude from IncludeObjectTypes ', function (): void {
|
||||
const model = new SchemaCompareOptionsModel(testUtils.getDeploymentOptions());
|
||||
model.deploymentOptions.excludeObjectTypes.value = ['SampleProperty1'];
|
||||
|
||||
should(model.deploymentOptions.excludeObjectTypes.value.length).be.equal(1, 'There should be one object type excluding from IncludeObjectTypes ');
|
||||
|
||||
// should return false for the default object types and false for the remaining object types
|
||||
Object.keys(model.deploymentOptions.objectTypesDictionary).forEach(option => {
|
||||
if (option === 'SampleProperty1') {
|
||||
should(model.getIncludeObjectTypeOptionCheckStatus(option)).equal(false, 'Object type property that have default object types to exclude from IncludeObjectTypes should return false');
|
||||
} else {
|
||||
should(model.getIncludeObjectTypeOptionCheckStatus(option)).equal(true, 'All including Object type should return true');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('Should get descriptions', function (): void {
|
||||
const model = new SchemaCompareOptionsModel(testUtils.getDeploymentOptions());
|
||||
model.getOptionsData();
|
||||
Object.entries(model.deploymentOptions.booleanOptionsDictionary).forEach(option => {
|
||||
should(model.getOptionDescription(option[1].displayName)).not.equal(undefined);
|
||||
should(model.getOptionDescription(option[1].displayName)).not.equal(undefined, 'Option description shouldn\'t be undefined');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ export function getDeploymentOptions(): mssql.DeploymentOptions {
|
||||
'SampleDisplayOption1': { value: false, description: sampleDesc, displayName: sampleName },
|
||||
'SampleDisplayOption2': { value: false, description: sampleDesc, displayName: sampleName }
|
||||
},
|
||||
includeObjectsDictionary: {
|
||||
objectTypesDictionary: {
|
||||
'SampleProperty1': sampleName,
|
||||
'SampleProperty2': sampleName
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user