MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / graph_path_and_subgraph

Function graph_path_and_subgraph

nodedb/tests/executor_tests/test_graph.rs:90–141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88
89#[test]
90fn graph_path_and_subgraph() {
91 let (mut core, mut tx, mut rx, _dir) = make_core();
92
93 for (s, d) in &[("a", "b"), ("b", "c")] {
94 send_ok(
95 &mut core,
96 &mut tx,
97 &mut rx,
98 PhysicalPlan::Graph(GraphOp::EdgePut {
99 collection: "col".into(),
100 src_id: s.to_string(),
101 label: "L".into(),
102 dst_id: d.to_string(),
103 properties: vec![],
104 src_surrogate: nodedb_types::Surrogate::ZERO,
105 dst_surrogate: nodedb_types::Surrogate::ZERO,
106 }),
107 );
108 }
109
110 let payload = send_ok(
111 &mut core,
112 &mut tx,
113 &mut rx,
114 PhysicalPlan::Graph(GraphOp::Path {
115 src: "a".into(),
116 dst: "c".into(),
117 edge_label: Some("L".into()),
118 max_depth: 5,
119 options: Default::default(),
120 rls_filters: Vec::new(),
121 frontier_bitmap: None,
122 }),
123 );
124 let path: Vec<String> = serde_json::from_value(payload_value(&payload)).unwrap();
125 assert_eq!(path, vec!["a", "b", "c"]);
126
127 let payload = send_ok(
128 &mut core,
129 &mut tx,
130 &mut rx,
131 PhysicalPlan::Graph(GraphOp::Subgraph {
132 start_nodes: vec!["a".into()],
133 edge_label: None,
134 depth: 2,
135 options: Default::default(),
136 rls_filters: Vec::new(),
137 }),
138 );
139 let edges: Vec<serde_json::Value> = serde_json::from_value(payload_value(&payload)).unwrap();
140 assert_eq!(edges.len(), 2);
141}
142
143#[test]
144fn edge_delete_updates_csr() {

Callers

nothing calls this directly

Calls 4

payload_valueFunction · 0.85
to_stringMethod · 0.80
make_coreFunction · 0.70
send_okFunction · 0.70

Tested by

no test coverage detected