[Location] Add getOriginal method

Add a getOriginal method to the location capability, to simplify
loading of original versions of objects. nasa/openmctweb#147
This commit is contained in:
Victor Woeltjen
2015-10-06 16:08:48 -07:00
parent d6fe543c16
commit 60f2f9fb6c
3 changed files with 49 additions and 9 deletions

View File

@@ -7,6 +7,7 @@ define(
'../ControlledPromise'
],
function (LocationCapability, domainObjectFactory, ControlledPromise) {
'use strict';
describe("LocationCapability", function () {
@@ -14,13 +15,16 @@ define(
var locationCapability,
persistencePromise,
mutationPromise,
mockQ,
mockInjector,
mockObjectService,
domainObject;
beforeEach(function () {
domainObject = domainObjectFactory({
capabilities: {
context: {
getParent: function() {
getParent: function () {
return domainObjectFactory({id: 'root'});
}
},
@@ -35,6 +39,11 @@ define(
}
});
mockQ = jasmine.createSpyObj("$q", ["when"]);
mockInjector = jasmine.createSpyObj("$injector", ["get"]);
mockObjectService =
jasmine.createSpyObj("objectService", ["getObjects"]);
persistencePromise = new ControlledPromise();
domainObject.capabilities.persistence.persist.andReturn(
persistencePromise
@@ -49,7 +58,11 @@ define(
}
);
locationCapability = new LocationCapability(domainObject);
locationCapability = new LocationCapability(
mockQ,
mockObjectService,
domainObject
);
});
it("returns contextual location", function () {