Insert simple test data (test nodes and relationships) Call this after setup_graph() to populate a fresh graph with simple data
(&self)
| 91 | /// Insert simple test data (test nodes and relationships) |
| 92 | /// Call this after setup_graph() to populate a fresh graph with simple data |
| 93 | pub fn insert_simple_data(&self) -> Result<(), String> { |
| 94 | // Insert test nodes |
| 95 | for i in 1..=20 { |
| 96 | self.query(&format!( |
| 97 | "INSERT (n:TestNode {{id: {}, name: 'Node {}', value: {}}})", |
| 98 | i, |
| 99 | i, |
| 100 | i * 10 |
| 101 | ))?; |
| 102 | } |
| 103 | |
| 104 | // Insert relationships (creates 9 edges: 1->2, 2->3, ..., 9->10) |
| 105 | for i in 1..10 { |
| 106 | self.query(&format!( |
| 107 | "MATCH (a:TestNode {{id: {}}}), (b:TestNode {{id: {}}}) |
| 108 | INSERT (a)-[:CONNECTS_TO {{weight: {}}}]->(b)", |
| 109 | i, |
| 110 | i + 1, |
| 111 | i * 2 |
| 112 | ))?; |
| 113 | } |
| 114 | |
| 115 | Ok(()) |
| 116 | } |
| 117 | |
| 118 | /// Create test fixture with fraud data |
| 119 | pub fn with_fraud_data() -> Result<Self, Box<dyn std::error::Error>> { |
no test coverage detected