mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 06:38:17 +00:00
[Add] Update spec for Instantiate
...to reflect usage of a model cache for #770
This commit is contained in:
@ -32,8 +32,7 @@ define(
|
|||||||
mockIdentifierService,
|
mockIdentifierService,
|
||||||
mockCapabilityConstructor,
|
mockCapabilityConstructor,
|
||||||
mockCapabilityInstance,
|
mockCapabilityInstance,
|
||||||
mockCapabilities,
|
mockCacheService,
|
||||||
mockIdentifier,
|
|
||||||
idCounter,
|
idCounter,
|
||||||
testModel,
|
testModel,
|
||||||
instantiate,
|
instantiate,
|
||||||
@ -62,11 +61,17 @@ define(
|
|||||||
"some-id-" + (idCounter += 1);
|
"some-id-" + (idCounter += 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mockCacheService = jasmine.createSpyObj(
|
||||||
|
'cacheService',
|
||||||
|
[ 'get', 'put', 'remove', 'all' ]
|
||||||
|
);
|
||||||
|
|
||||||
testModel = { someKey: "some value" };
|
testModel = { someKey: "some value" };
|
||||||
|
|
||||||
instantiate = new Instantiate(
|
instantiate = new Instantiate(
|
||||||
mockCapabilityService,
|
mockCapabilityService,
|
||||||
mockIdentifierService
|
mockIdentifierService,
|
||||||
|
mockCacheService
|
||||||
);
|
);
|
||||||
domainObject = instantiate(testModel);
|
domainObject = instantiate(testModel);
|
||||||
});
|
});
|
||||||
@ -92,6 +97,13 @@ define(
|
|||||||
expect(instantiate(testModel).getId())
|
expect(instantiate(testModel).getId())
|
||||||
.not.toEqual(domainObject.getId());
|
.not.toEqual(domainObject.getId());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("caches the instantiated model", function () {
|
||||||
|
expect(mockCacheService.put).toHaveBeenCalledWith(
|
||||||
|
domainObject.getId(),
|
||||||
|
testModel
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user