mirror of
https://github.com/nasa/openmct.git
synced 2025-03-22 03:55:31 +00:00
[Create] Test optional filter parameter
This commit is contained in:
parent
99a454f943
commit
53a49a671b
@ -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 () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user