mirror of
https://github.com/nasa/openmct.git
synced 2025-05-08 11:38:35 +00:00
[Timeline] Add capabilities to test inputs
This commit is contained in:
parent
66b1a92554
commit
5ee5e7fea1
@ -42,6 +42,7 @@ define([
|
|||||||
'getModel'
|
'getModel'
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
mockRelationships,
|
||||||
model = testModels[id];
|
model = testModels[id];
|
||||||
|
|
||||||
mockDomainObject.getId.andReturn(id);
|
mockDomainObject.getId.andReturn(id);
|
||||||
@ -53,6 +54,31 @@ define([
|
|||||||
false;
|
false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!!model.composition) {
|
||||||
|
mockDomainObject.useCapability.andCallFake(function (c) {
|
||||||
|
return c === 'composition' &&
|
||||||
|
Promise.resolve(model.composition.map(function (id) {
|
||||||
|
return mockDomainObjects[id]
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!!model.relationships) {
|
||||||
|
mockRelationships = jasmine.createSpyObj(
|
||||||
|
'relationship',
|
||||||
|
['getRelatedObjects']
|
||||||
|
);
|
||||||
|
mockRelationships.getRelatedObjects.andCallFake(function (k) {
|
||||||
|
var ids = model.relationships[k] || [];
|
||||||
|
return Promise.resolve(ids.map(function (id) {
|
||||||
|
return mockDomainObjects[id];
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
mockDomainObject.getCapability.andCallFake(function (c) {
|
||||||
|
return c === 'relationship' && mockRelationships;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
mockDomainObjects[id] = mockDomainObject;
|
mockDomainObjects[id] = mockDomainObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user