[Create] Test optional filter parameter
This commit is contained in:
@@ -388,6 +388,7 @@ define(
|
|||||||
expect(childObjectClone.getModel().location).toEqual(objectClone.getId());
|
expect(childObjectClone.getModel().location).toEqual(objectClone.getId());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("when cloning non-creatable objects", function() {
|
describe("when cloning non-creatable objects", function() {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
policyService.allow.andCallFake(function(category){
|
policyService.allow.andCallFake(function(category){
|
||||||
@@ -406,6 +407,31 @@ define(
|
|||||||
.toHaveBeenCalledWith(copiedObject);
|
.toHaveBeenCalledWith(copiedObject);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("when provided a filtering function", function () {
|
||||||
|
function accept() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function reject() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
it("does not create new instances of objects " +
|
||||||
|
"rejected by the filter", function() {
|
||||||
|
copyService.perform(object, newParent, reject)
|
||||||
|
.then(copyFinished);
|
||||||
|
expect(copyFinished.mostRecentCall.args[0])
|
||||||
|
.toBe(object);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does create new instances of objects " +
|
||||||
|
"accepted by the filter", function() {
|
||||||
|
copyService.perform(object, newParent, accept)
|
||||||
|
.then(copyFinished);
|
||||||
|
expect(copyFinished.mostRecentCall.args[0])
|
||||||
|
.not.toBe(object);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("on invalid inputs", function () {
|
describe("on invalid inputs", function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user