mirror of
https://github.com/nasa/openmct.git
synced 2025-06-05 17:01:41 +00:00
[Persistence] Don't expect persist calls in spec
This commit is contained in:
parent
360fdeaec8
commit
1e03f22086
@ -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();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user