[Persistence] Don't expect persist calls in spec

This commit is contained in:
Victor Woeltjen
2016-05-19 11:44:26 -07:00
parent d5914dfde9
commit 360fdeaec8

View File

@@ -50,10 +50,6 @@ define(
'mutation', 'mutation',
['mutate'] ['mutate']
); );
mockCapabilities.persistence = jasmine.createSpyObj(
'persistence',
['persist']
);
mockCapabilities.type = jasmine.createSpyObj( mockCapabilities.type = jasmine.createSpyObj(
'type', 'type',
['instanceOf'] ['instanceOf']
@@ -115,11 +111,6 @@ define(
.toHaveBeenCalledWith(jasmine.any(Function)); .toHaveBeenCalledWith(jasmine.any(Function));
mockCapabilities.mutation.mutate.mostRecentCall.args[0](testModel); mockCapabilities.mutation.mutate.mostRecentCall.args[0](testModel);
expect(testModel.relationships.modes).toEqual(['abc', 'xyz']); expect(testModel.relationships.modes).toEqual(['abc', 'xyz']);
// Verify that persistence is called when promise resolves
expect(mockCapabilities.persistence.persist).not.toHaveBeenCalled();
mockPromise.then.mostRecentCall.args[0]();
expect(mockCapabilities.persistence.persist).toHaveBeenCalled();
}); });
it("mutates modes when used as a setter", function () { it("mutates modes when used as a setter", function () {
@@ -128,11 +119,6 @@ define(
.toHaveBeenCalledWith(jasmine.any(Function)); .toHaveBeenCalledWith(jasmine.any(Function));
mockCapabilities.mutation.mutate.mostRecentCall.args[0](testModel); mockCapabilities.mutation.mutate.mostRecentCall.args[0](testModel);
expect(testModel.link).toEqual("http://www.noaa.gov"); expect(testModel.link).toEqual("http://www.noaa.gov");
// Verify that persistence is called when promise resolves
expect(mockCapabilities.persistence.persist).not.toHaveBeenCalled();
mockPromise.then.mostRecentCall.args[0]();
expect(mockCapabilities.persistence.persist).toHaveBeenCalled();
}); });
it("does not mutate modes when unchanged", function () { it("does not mutate modes when unchanged", function () {