diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/element-comparison.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/element-comparison.js index de741507e80..6f53ab89580 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/element-comparison.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/element-comparison.js @@ -25,9 +25,8 @@ function deepSort(obj) { if (!Array.isArray(obj)) { return obj; } else { - obj.map((item) => deepSort(item)); + return obj.map((item) => deepSort(item)).sort(); } - return obj.sort(); } function deepCopy(obj) { @@ -111,8 +110,21 @@ function deepMembersByIdOrdered(a, b) { return deepMembersById(a, b, true) } +function deepIncludesById(array, subset) { + console.log(array); + console.log(subset); + for (let item of subset) { + const included = array.some((arrayItem) => deepMembersById(item, arrayItem)); + if (!included) { + return false; + } + } + return true; +} + module.exports = { deepCopy, + deepIncludesById, deepMembersById, deepMembersByIdOrdered, deepSort,