[Persistence] Update spec

Update spec for persistence capability to reflect changes for
nasa/openmctweb#92
This commit is contained in:
Victor Woeltjen 2015-08-28 15:18:53 -07:00
parent 620c0415cf
commit e4d136d345

View File

@ -48,7 +48,7 @@ define(
beforeEach(function () {
mockPersistenceService = jasmine.createSpyObj(
"persistenceService",
[ "updateObject", "readObject" ]
[ "updateObject", "readObject", "createObject", "deleteObject" ]
);
mockDomainObject = {
getId: function () { return id; },
@ -68,10 +68,24 @@ define(
);
});
it("makes a call to the persistence service when invoked", function () {
it("creates unpersisted objects with the persistence service", function () {
// Verify precondition; no call made during constructor
expect(mockPersistenceService.createObject).not.toHaveBeenCalled();
persistence.persist();
expect(mockPersistenceService.createObject).toHaveBeenCalledWith(
SPACE,
id,
model
);
});
it("updates previously persisted objects with the persistence service", function () {
// Verify precondition; no call made during constructor
expect(mockPersistenceService.updateObject).not.toHaveBeenCalled();
model.persisted = 12321;
persistence.persist();
expect(mockPersistenceService.updateObject).toHaveBeenCalledWith(
@ -112,4 +126,4 @@ define(
});
}
);
);