diff --git a/platform/entanglement/test/services/CopyServiceSpec.js b/platform/entanglement/test/services/CopyServiceSpec.js index e1849ec60c..fb5092ba65 100644 --- a/platform/entanglement/test/services/CopyServiceSpec.js +++ b/platform/entanglement/test/services/CopyServiceSpec.js @@ -388,6 +388,7 @@ define( expect(childObjectClone.getModel().location).toEqual(objectClone.getId()); }); }); + describe("when cloning non-creatable objects", function() { beforeEach(function () { policyService.allow.andCallFake(function(category){ @@ -406,6 +407,31 @@ define( .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 () {