mirror of
https://github.com/nasa/openmct.git
synced 2024-12-22 22:42:24 +00:00
2648f01966
Disallow composition for domain object types which will not have a composition property; WTD-1221.
27 lines
878 B
JavaScript
27 lines
878 B
JavaScript
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
|
|
|
define(
|
|
["../src/CompositionModelPolicy"],
|
|
function (CompositionModelPolicy) {
|
|
"use strict";
|
|
|
|
describe("The composition model policy", function () {
|
|
var mockType,
|
|
policy;
|
|
|
|
beforeEach(function () {
|
|
mockType = jasmine.createSpyObj('type', ['getInitialModel']);
|
|
policy = new CompositionModelPolicy();
|
|
});
|
|
|
|
it("only allows composition for types which will have a composition property", function () {
|
|
mockType.getInitialModel.andReturn({});
|
|
expect(policy.allow(mockType)).toBeFalsy();
|
|
mockType.getInitialModel.andReturn({ composition: [] });
|
|
expect(policy.allow(mockType)).toBeTruthy();
|
|
});
|
|
});
|
|
|
|
}
|
|
);
|