Addresses comments.

This commit is contained in:
Joshi 2019-12-19 21:20:38 -08:00
parent 55a195b841
commit 87f76ebfe4
2 changed files with 14 additions and 22 deletions

View File

@ -20,51 +20,43 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import ConditionSetCompositionPolicy from './conditionSetCompositionPolicy';
import ConditionSetCompositionPolicy from './ConditionSetCompositionPolicy';
import { createOpenMct } from "testTools";
describe('ConditionSetCompositionPolicy', () => {
let policy;
let openmct;
let parentDomainObject;
let childDomainObject;
let composition;
beforeEach(function () {
openmct = createOpenMct();
policy = new ConditionSetCompositionPolicy(openmct);
policy = new ConditionSetCompositionPolicy();
parentDomainObject = {};
childDomainObject = {};
composition = {};
});
it('returns true for object types that are not conditionSets', function () {
parentDomainObject = {
type: 'random'
};
childDomainObject = {
type: ''
};
parentDomainObject.type = 'random';
childDomainObject.type = '';
expect(policy.allow(parentDomainObject, childDomainObject)).toBe(true);
});
it('returns false for object types that are not conditions when parent is a conditionSet', function () {
parentDomainObject = {
type: 'conditionSet'
};
childDomainObject = {
type: ''
};
parentDomainObject.type = 'conditionSet';
childDomainObject.type = '';
expect(policy.allow(parentDomainObject, childDomainObject)).toBe(false);
});
it('returns true for object types that are conditions when parent is a conditionSet', function () {
parentDomainObject = {
type: 'conditionSet'
};
childDomainObject = {
type: 'condition'
};
parentDomainObject.type = 'conditionSet';
childDomainObject.type = 'condition';
expect(policy.allow(parentDomainObject, childDomainObject)).toBe(true);
});
it('returns true for object types that are conditions when parent is not a conditionSet', function () {
parentDomainObject.type = 'random';
childDomainObject.type = 'condition';
expect(policy.allow(parentDomainObject, childDomainObject)).toBe(true);
});