mirror of
https://github.com/nasa/openmct.git
synced 2024-12-30 18:06:59 +00:00
31 lines
977 B
JavaScript
31 lines
977 B
JavaScript
|
|
define(
|
|
["../src/CompositionModelPolicy"],
|
|
function (CompositionModelPolicy) {
|
|
|
|
describe("The composition model policy", function () {
|
|
var mockObject,
|
|
mockType,
|
|
policy;
|
|
|
|
beforeEach(function () {
|
|
mockType = jasmine.createSpyObj('type', ['getInitialModel']);
|
|
mockObject = {
|
|
getCapability: function () {
|
|
return mockType;
|
|
}
|
|
};
|
|
policy = new CompositionModelPolicy();
|
|
});
|
|
|
|
it("only allows composition for types which will have a composition property", function () {
|
|
mockType.getInitialModel.andReturn({});
|
|
expect(policy.allow(mockObject)).toBeFalsy();
|
|
mockType.getInitialModel.andReturn({ composition: [] });
|
|
expect(policy.allow(mockObject)).toBeTruthy();
|
|
});
|
|
});
|
|
|
|
}
|
|
);
|