diff --git a/platform/core/test/services/InstantiateSpec.js b/platform/core/test/services/InstantiateSpec.js index cb25feaac2..fcad45813a 100644 --- a/platform/core/test/services/InstantiateSpec.js +++ b/platform/core/test/services/InstantiateSpec.js @@ -32,8 +32,7 @@ define( mockIdentifierService, mockCapabilityConstructor, mockCapabilityInstance, - mockCapabilities, - mockIdentifier, + mockCacheService, idCounter, testModel, instantiate, @@ -62,11 +61,17 @@ define( "some-id-" + (idCounter += 1); }); + mockCacheService = jasmine.createSpyObj( + 'cacheService', + [ 'get', 'put', 'remove', 'all' ] + ); + testModel = { someKey: "some value" }; instantiate = new Instantiate( mockCapabilityService, - mockIdentifierService + mockIdentifierService, + mockCacheService ); domainObject = instantiate(testModel); }); @@ -92,6 +97,13 @@ define( expect(instantiate(testModel).getId()) .not.toEqual(domainObject.getId()); }); + + it("caches the instantiated model", function () { + expect(mockCacheService.put).toHaveBeenCalledWith( + domainObject.getId(), + testModel + ); + }); }); }