[Add] Update persistence capability spec

...to reflect removal of cached domain object models.
This commit is contained in:
Victor Woeltjen 2016-03-21 15:08:27 -07:00
parent 1e4ff5a73f
commit baccd005dc

@ -36,6 +36,7 @@ define(
mockDomainObject,
mockIdentifier,
mockNofificationService,
mockCacheService,
mockQ,
id = "object id",
model,
@ -81,6 +82,10 @@ define(
"notificationService",
["error"]
);
mockCacheService = jasmine.createSpyObj(
"cacheService",
[ "get", "put", "remove", "all" ]
);
mockDomainObject = {
getId: function () { return id; },
@ -96,6 +101,7 @@ define(
mockIdentifierService.parse.andReturn(mockIdentifier);
mockIdentifier.getSpace.andReturn(SPACE);
persistence = new PersistenceCapability(
mockCacheService,
mockPersistenceService,
mockIdentifierService,
mockNofificationService,
@ -170,6 +176,11 @@ define(
expect(mockQ.reject).not.toHaveBeenCalled();
expect(mockNofificationService.error).not.toHaveBeenCalled();
});
it("removes the model from the cache", function () {
persistence.persist();
expect(mockCacheService.remove).toHaveBeenCalledWith(id);
});
});
describe("unsuccessful persistence", function() {
var sadPromise = {