mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 06:03:08 +00:00
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');
|
||
|
});
|
||
|
});
|
||
|
|
||
|
}
|
||
|
);
|