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