Skip to content

Commit

Permalink
Remove bail out behavior if one of the entrypoints does not exist
Browse files Browse the repository at this point in the history
For lookupStrategy "multipleIdOrName", we should not bail out if one
of the provided entrypoints does not exist. Instead we should just
exlcude this invalid point.
  • Loading branch information
ceoro9 authored and aleksr011 committed Jul 31, 2021
1 parent 09e11bc commit 4b837ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 0 additions & 8 deletions lib/runner/extract-runnable-items.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,6 @@ var sdk = require('postman-collection'),
});
}

// at this point of time, we should have traversed all items mentioned in entrypoint and created a linear
// subset of items. However, if post that, we still have items remaining in lookup object, that implies that
// extra items were present in user input and corresponding items for those do not exist in collection. As such
// we need to bail out if any of the given entry-point is not found.
if (Object.keys(entrypointLookup).length) {
return callback(null, []);
}

// extract runnable items from the searched items.
for (i = 0, ii = items.members.length; i < ii; i++) {
runnableItems = runnableItems.concat(flattenNode(items.members[i]));
Expand Down
8 changes: 4 additions & 4 deletions test/unit/extract-runnable-items.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,16 @@ describe('extractRunnableItems', function () {
);
});

it('should bail out if any of the given entrypoint is not found. ', function (done) {
it('should exclude non-existent entry points and return only valid items', function (done) {
extractRunnableItems(
collection, {
execute: ['ID3', 'RANDOM'],
execute: ['RANDOM', 'F1.R1', 'F2.R1'],
lookupStrategy: 'multipleIdOrName'
},
function (err, runnableItems, entrypoint) {
expect(err).to.be.null;
expect(runnableItems).to.eql([]);
expect(entrypoint).to.be.undefined;
expect(_.map(runnableItems, 'name')).to.eql(['F1.R1', 'F2.R1']);
expect(entrypoint).to.have.property('name', 'Collection C1');
done();
}
);
Expand Down

0 comments on commit 4b837ec

Please sign in to comment.