mirror of
https://github.com/nasa/openmct.git
synced 2025-05-08 19:48:41 +00:00
[Timeline] Add capabilities to test inputs
This commit is contained in:
parent
66b1a92554
commit
5ee5e7fea1
@ -42,6 +42,7 @@ define([
|
||||
'getModel'
|
||||
]
|
||||
),
|
||||
mockRelationships,
|
||||
model = testModels[id];
|
||||
|
||||
mockDomainObject.getId.andReturn(id);
|
||||
@ -53,6 +54,31 @@ define([
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user