[Add] Update spec for Instantiate

...to reflect usage of a model cache for #770
This commit is contained in:
Victor Woeltjen 2016-03-21 15:04:03 -07:00
parent d12111d9b8
commit 9f29382e18

View File

@ -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
);
});
});
}