[Persistence] Don't expect persist calls in PropertiesAction spec

This commit is contained in:
Victor Woeltjen 2016-05-19 12:04:08 -07:00
parent 63438ad9ba
commit 8279acc9a5

View File

@ -41,7 +41,6 @@ define(
getProperties: function () { return []; }, getProperties: function () { return []; },
hasFeature: jasmine.createSpy('hasFeature') hasFeature: jasmine.createSpy('hasFeature')
}, },
persistence: jasmine.createSpyObj("persistence", ["persist"]),
mutation: jasmine.createSpy("mutation") mutation: jasmine.createSpy("mutation")
}; };
model = {}; model = {};
@ -66,25 +65,18 @@ define(
action = new PropertiesAction(dialogService, context); action = new PropertiesAction(dialogService, context);
}); });
it("persists when an action is performed", function () {
action.perform();
expect(capabilities.persistence.persist)
.toHaveBeenCalled();
});
it("does not persist any changes upon cancel", function () {
input = undefined;
action.perform();
expect(capabilities.persistence.persist)
.not.toHaveBeenCalled();
});
it("mutates an object when performed", function () { it("mutates an object when performed", function () {
action.perform(); action.perform();
expect(capabilities.mutation).toHaveBeenCalled(); expect(capabilities.mutation).toHaveBeenCalled();
capabilities.mutation.mostRecentCall.args[0]({}); capabilities.mutation.mostRecentCall.args[0]({});
}); });
it("does not muate object upon cancel", function () {
input = undefined;
action.perform();
expect(capabilities.mutation).not.toHaveBeenCalled();
});
it("is only applicable when a domain object is in context", function () { it("is only applicable when a domain object is in context", function () {
expect(PropertiesAction.appliesTo(context)).toBeTruthy(); expect(PropertiesAction.appliesTo(context)).toBeTruthy();
expect(PropertiesAction.appliesTo({})).toBeFalsy(); expect(PropertiesAction.appliesTo({})).toBeFalsy();