[API] composition providers receive new-style objects

Ensure that composition providers get new-style objects (with id
included) so that they can properly check for applicability.
This commit is contained in:
Pete Richards
2017-02-15 12:15:34 -08:00
parent 46c7399867
commit 8e13819e1e
7 changed files with 26 additions and 17 deletions

View File

@@ -50,7 +50,7 @@ define(
this.capabilityService = capabilityService;
}
QueuingPersistenceCapabilityDecorator.prototype.getCapabilities = function (model) {
QueuingPersistenceCapabilityDecorator.prototype.getCapabilities = function (model, id) {
var capabilityService = this.capabilityService,
persistenceQueue = this.persistenceQueue;
@@ -76,7 +76,7 @@ define(
}
return decoratePersistence(
capabilityService.getCapabilities(model)
capabilityService.getCapabilities(model, id)
);
};

View File

@@ -32,6 +32,7 @@ define(
mockPersistence,
mockDomainObject,
testModel,
testId,
decorator;
beforeEach(function () {
@@ -41,6 +42,7 @@ define(
['getCapabilities']
);
testModel = { someKey: "some value" };
testId = 'someId';
mockPersistence = jasmine.createSpyObj(
'persistence',
['persist', 'refresh']
@@ -67,9 +69,9 @@ define(
// QueuingPersistenceCapability itself, which has its own tests.
it("delegates to its wrapped service", function () {
decorator.getCapabilities(testModel);
decorator.getCapabilities(testModel, testId);
expect(mockCapabilityService.getCapabilities)
.toHaveBeenCalledWith(testModel);
.toHaveBeenCalledWith(testModel, testId);
});
it("wraps its persistence capability's constructor", function () {