[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

View File

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