mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 06:03:08 +00:00
036722b275
Disallow composition in objects which cannot be created, under the rationale that creatable objects must also be immutable. WTD-1098.
26 lines
896 B
JavaScript
26 lines
896 B
JavaScript
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
|
|
|
define(
|
|
["../src/CompositionMutabilityPolicy"],
|
|
function (CompositionMutabilityPolicy) {
|
|
"use strict";
|
|
|
|
describe("The composition mutability policy", function () {
|
|
var mockType,
|
|
policy;
|
|
|
|
beforeEach(function () {
|
|
mockType = jasmine.createSpyObj('type', ['hasFeature']);
|
|
policy = new CompositionMutabilityPolicy();
|
|
});
|
|
|
|
it("only allows composition for types which will have a composition capability", function () {
|
|
expect(policy.allow(mockType)).toBeFalsy();
|
|
mockType.hasFeature.andReturn(true);
|
|
expect(policy.allow(mockType)).toBeTruthy();
|
|
expect(mockType.hasFeature).toHaveBeenCalledWith('creation');
|
|
});
|
|
});
|
|
|
|
}
|
|
); |