Skip to content

Commit

Permalink
test: simply access to required topology directive
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Oct 15, 2019
1 parent 8e5391d commit 558d4fb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/runner/filters/mongodb_topology_filter.js
Expand Up @@ -27,11 +27,15 @@ class MongoDBTopologyFilter {
if (!test.metadata.requires) return true;
if (!test.metadata.requires.topology) return true;

let topologies = null;
if (typeof test.metadata.requires.topology === 'string') {
topologies = [test.metadata.requires.topology];
} else if (Array.isArray(test.metadata.requires.topology)) {
topologies = test.metadata.requires.topology;
const requiredTopology =
test.metadata && test.metadata.requires && test.metadata.requires.topology;
if (!requiredTopology) return true;

let topologies;
if (typeof requiredTopology === 'string') {
topologies = [requiredTopology];
} else if (Array.isArray(requiredTopology)) {
topologies = requiredTopology;
} else {
throw new TypeError(
'MongoDBTopologyFilter only supports single string topology or an array of string topologies'
Expand Down

0 comments on commit 558d4fb

Please sign in to comment.