MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / test_data_driven_match_queries

Function test_data_driven_match_queries

graphlite/tests/fixture_tests.rs:171–225  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

169
170#[test]
171fn test_data_driven_match_queries() {
172 let test_suite = TestSuite {
173 name: "MATCH Query Tests".to_string(),
174 fixture_type: FixtureType::Fraud,
175 test_cases: vec![
176 TestCase {
177 name: "count_all_nodes".to_string(),
178 description: "Count all nodes in the graph".to_string(),
179 query: "MATCH (n) RETURN count(n) as total".to_string(),
180 expected_rows: Some(1),
181 expected_values: Some(HashMap::from([("total".to_string(), Value::Number(70.0))])), // 50 accounts + 20 merchants
182 expected_error: None,
183 },
184 TestCase {
185 name: "count_all_relationships".to_string(),
186 description: "Count all relationships in the graph".to_string(),
187 query: "MATCH ()-[r]->() RETURN count(r) as total".to_string(),
188 expected_rows: Some(1),
189 expected_values: Some(HashMap::from([("total".to_string(), Value::Number(150.0))])), // 100 transactions + 50 purchases
190 expected_error: None,
191 },
192 TestCase {
193 name: "find_accounts_by_status".to_string(),
194 description: "Find active accounts (all 50 are active)".to_string(),
195 query: "MATCH (a:Account) WHERE a.status = 'active' RETURN count(a) as count"
196 .to_string(),
197 expected_rows: Some(1),
198 expected_values: Some(HashMap::from([("count".to_string(), Value::Number(50.0))])), // all active
199 expected_error: None,
200 },
201 TestCase {
202 name: "retail_merchants".to_string(),
203 description: "Find retail merchants (all are retail)".to_string(),
204 query: "MATCH (m:Merchant) WHERE m.category = 'retail' RETURN count(m) as count"
205 .to_string(),
206 expected_rows: Some(1),
207 expected_values: Some(HashMap::from([("count".to_string(), Value::Number(20.0))])), // all retail
208 expected_error: None,
209 },
210 TestCase {
211 name: "transaction_count".to_string(),
212 description: "Count all transactions".to_string(),
213 query: "MATCH ()-[t:Transaction]->() RETURN count(t) as count".to_string(),
214 expected_rows: Some(1),
215 expected_values: Some(HashMap::from([("count".to_string(), Value::Number(100.0))])),
216 expected_error: None,
217 },
218 ],
219 };
220
221 let results = test_suite.run().expect("Failed to run test suite");
222 results.print_summary();
223
224 assert_eq!(results.failed, 0, "All test cases should pass");
225}
226
227#[test]
228fn test_data_driven_aggregation_queries() {

Callers

nothing calls this directly

Calls 2

runMethod · 0.80
print_summaryMethod · 0.80

Tested by

no test coverage detected