[Persistence] Don't expect persist calls in spec

This commit is contained in:
Victor Woeltjen 2016-05-19 11:45:46 -07:00
parent 360fdeaec8
commit 1e03f22086

View File

@ -32,7 +32,6 @@ define(
mockDomainObjects, mockDomainObjects,
mockTimespans, mockTimespans,
mockMutations, mockMutations,
mockPersists,
mockCallback, mockCallback,
handler; handler;
@ -66,7 +65,6 @@ define(
mockDomainObject.useCapability.andReturn(asPromise(mockTimespans[id])); mockDomainObject.useCapability.andReturn(asPromise(mockTimespans[id]));
mockDomainObject.getCapability.andCallFake(function (c) { mockDomainObject.getCapability.andCallFake(function (c) {
return { return {
persistence: mockPersists[id],
mutation: mockMutations[id] mutation: mockMutations[id]
}[c]; }[c];
}); });
@ -76,17 +74,12 @@ define(
beforeEach(function () { beforeEach(function () {
mockTimespans = {}; mockTimespans = {};
mockPersists = {};
mockMutations = {}; mockMutations = {};
['a', 'b', 'c', 'd', 'e', 'f'].forEach(function (id, index) { ['a', 'b', 'c', 'd', 'e', 'f'].forEach(function (id, index) {
mockTimespans[id] = jasmine.createSpyObj( mockTimespans[id] = jasmine.createSpyObj(
'timespan-' + id, 'timespan-' + id,
[ 'getStart', 'getEnd', 'getDuration', 'setStart', 'setEnd', 'setDuration' ] [ 'getStart', 'getEnd', 'getDuration', 'setStart', 'setEnd', 'setDuration' ]
); );
mockPersists[id] = jasmine.createSpyObj(
'persistence-' + id,
[ 'persist' ]
);
mockMutations[id] = jasmine.createSpyObj( mockMutations[id] = jasmine.createSpyObj(
'mutation-' + id, 'mutation-' + id,
[ 'mutate' ] [ 'mutate' ]
@ -209,20 +202,6 @@ define(
expect(mockTimespans.c.setStart).toHaveBeenCalledWith(1000); expect(mockTimespans.c.setStart).toHaveBeenCalledWith(1000);
}); });
it("persists mutated objects", function () {
handler.start('a', 20);
handler.end('b', 50);
handler.duration('c', 30);
handler.persist();
expect(mockPersists.a.persist).toHaveBeenCalled();
expect(mockPersists.b.persist).toHaveBeenCalled();
expect(mockPersists.c.persist).toHaveBeenCalled();
expect(mockPersists.d.persist).not.toHaveBeenCalled();
expect(mockPersists.e.persist).not.toHaveBeenCalled();
expect(mockPersists.f.persist).not.toHaveBeenCalled();
});
}); });
} }
); );