Skip to content

Commit d3b59c6

Browse files
Aniela AmySanjeevani19
authored andcommitted
DHFPROD-9660: Improving tests for graphSearchFacets.
1 parent 538518e commit d3b59c6

File tree

1 file changed

+16
-5
lines changed
  • marklogic-data-hub/src/test/ml-modules/root/test/suites/data-hub/5/data-services/graph

1 file changed

+16
-5
lines changed

marklogic-data-hub/src/test/ml-modules/root/test/suites/data-hub/5/data-services/graph/graphSearchFacets.sjs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,25 @@ let expectedEdgeCount = graphUtils.supportsGraphConceptsSearch() ? 4 : 0;
3232
let assertions = [
3333
test.assertEqual(expectedNodeCount, resultsTest.total),
3434
test.assertEqual(expectedNodeCount, resultsTest.nodes.length),
35-
test.assertEqual(expectedEdgeCount, resultsTest.edges.length),
36-
test.assertTrue(resultsTest.nodes[0].hasRelationships)
35+
test.assertEqual(expectedEdgeCount, resultsTest.edges.length)
3736
];
3837

38+
3939
resultsTest.nodes.forEach(node => {
40-
if (node.docUri) {
41-
assertions.push(test.assertTrue(node.docUri.includes("product")));
42-
}
40+
resultsTest.nodes.forEach(node => {
41+
if(node.id === "/content/product100.json") {
42+
assertions.push(test.assertTrue(node.hasRelationships, `Product 100 must have relationships flag in true. Result: ${xdmp.toJsonString(node)}`));
43+
}
44+
else if(node.id === "/content/product50.json") {
45+
assertions.push(test.assertFalse(node.hasRelationships, `Product 50 must have relationships flag in false. Result: ${xdmp.toJsonString(node)}`));
46+
}
47+
else if(node.id === "/content/product60.json") {
48+
assertions.push(test.assertFalse(node.hasRelationships, `Product 60 must have relationships flag in false. Result: ${xdmp.toJsonString(node)}`));
49+
}
50+
if (!node.isConcept) {
51+
assertions.push(test.assertTrue(node.docUri.includes("product")));
52+
}
53+
})
4354
})
4455

4556
assertions;

0 commit comments

Comments
 (0)