(t *testing.T)
| 1044 | } |
| 1045 | |
| 1046 | func TestShortestPathWithDepth(t *testing.T) { |
| 1047 | // Shortest path between A and B is the path A => C => D => B but if the depth is less than 3 |
| 1048 | // then the direct path between A and B should be returned. |
| 1049 | query := ` |
| 1050 | query test ($depth: int, $numpaths: int) { |
| 1051 | a as var(func: eq(name, "A")) |
| 1052 | b as var(func: eq(name, "B")) |
| 1053 | |
| 1054 | path as shortest(from: uid(a), to: uid(b), depth: $depth, numpaths: $numpaths) { |
| 1055 | connects @facets(weight) |
| 1056 | } |
| 1057 | |
| 1058 | path(func: uid(path)) { |
| 1059 | uid |
| 1060 | name |
| 1061 | } |
| 1062 | }` |
| 1063 | |
| 1064 | directPath := ` |
| 1065 | { |
| 1066 | "data": { |
| 1067 | "path": [ |
| 1068 | { |
| 1069 | "uid": "0x33", |
| 1070 | "name": "A" |
| 1071 | }, |
| 1072 | { |
| 1073 | "uid": "0x34", |
| 1074 | "name": "B" |
| 1075 | } |
| 1076 | ], |
| 1077 | "_path_": [ |
| 1078 | { |
| 1079 | "connects": { |
| 1080 | "uid": "0x34", |
| 1081 | "connects|weight": 11 |
| 1082 | }, |
| 1083 | "uid": "0x33", |
| 1084 | "_weight_": 11 |
| 1085 | } |
| 1086 | ] |
| 1087 | } |
| 1088 | }` |
| 1089 | |
| 1090 | shortestPath := ` |
| 1091 | { |
| 1092 | "data": { |
| 1093 | "path": [ |
| 1094 | { |
| 1095 | "uid": "0x33", |
| 1096 | "name": "A" |
| 1097 | }, |
| 1098 | { |
| 1099 | "uid": "0x35", |
| 1100 | "name": "C" |
| 1101 | }, |
| 1102 | { |
| 1103 | "uid": "0x36", |
nothing calls this directly
no test coverage detected