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

Function test_basic_queries

graphlite/tests/set_operations_tests.rs:367–414  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

365
366#[test]
367fn test_basic_queries() {
368 let fixture = create_tutorial_test_fixture().expect("Failed to create test fixture");
369
370 // Test 1: Check department nodes exist with correct names
371 let query1 = "MATCH (d:Department) RETURN d.name";
372 let result1 = fixture
373 .query(query1)
374 .expect("Department query should succeed");
375 log::debug!("Departments: {} rows", result1.rows.len());
376 for row in &result1.rows {
377 let dept_name = row.values["d.name"].as_string().unwrap();
378 log::debug!(" Department: {}", dept_name);
379 }
380
381 // Test 2: Check if Department filtering works
382 let query2 = "MATCH (d:Department {name: 'IT'}) RETURN d.name";
383 let result2 = fixture
384 .query(query2)
385 .expect("IT department query should succeed");
386 log::debug!("IT departments: {} rows", result2.rows.len());
387 for row in &result2.rows {
388 let dept_name = row.values["d.name"].as_string().unwrap();
389 log::debug!(" IT Department: {}", dept_name);
390 }
391
392 // Test 3: Simple relationship without target constraints
393 let query3 = "MATCH (p:Person)-[:WORKS_IN]->(d:Department) RETURN p.name, d.name";
394 let result3 = fixture
395 .query(query3)
396 .expect("Basic relationship query should succeed");
397 log::debug!("Basic relationships: {} rows", result3.rows.len());
398 for row in &result3.rows {
399 let person = row.values["p.name"].as_string().unwrap();
400 let dept = row.values["d.name"].as_string().unwrap();
401 log::debug!(" {} -> {}", person, dept);
402 }
403
404 // Test 4: The problematic query - relationship with target constraints
405 let query4 = "MATCH (p:Person)-[:WORKS_IN]->(d:Department {name: 'IT'}) RETURN p.name";
406 let result4 = fixture
407 .query(query4)
408 .expect("IT relationship query should succeed");
409 log::debug!("IT relationship: {} rows", result4.rows.len());
410 for row in &result4.rows {
411 let person = row.values["p.name"].as_string().unwrap();
412 log::debug!(" {} works in IT", person);
413 }
414}
415
416#[test]
417fn test_debug_relationships() {

Callers

nothing calls this directly

Calls 4

unwrapMethod · 0.80
queryMethod · 0.45
as_stringMethod · 0.45

Tested by

no test coverage detected