()
| 11 | |
| 12 | #[test] |
| 13 | fn test_insert_operations() { |
| 14 | let fixture = TestFixture::new().expect("Failed to create test fixture"); |
| 15 | // Setup fresh graph for this test to avoid interference |
| 16 | fixture |
| 17 | .setup_graph("test_insert_operations") |
| 18 | .expect("Failed to setup graph"); |
| 19 | |
| 20 | // Test basic node insertion |
| 21 | fixture.assert_query_succeeds("INSERT (new_node:Person {name: 'John Doe', age: 30})"); |
| 22 | |
| 23 | // Verify insertion |
| 24 | fixture.assert_first_value( |
| 25 | "MATCH (p:Person) WHERE p.name = 'John Doe' RETURN count(p) as count", |
| 26 | "count", |
| 27 | Value::Number(1.0), |
| 28 | ); |
| 29 | |
| 30 | // Test multiple node insertion |
| 31 | fixture.assert_query_succeeds( |
| 32 | "INSERT (alice:Person {name: 'Alice', age: 25}), |
| 33 | (bob:Person {name: 'Bob', age: 28})", |
| 34 | ); |
| 35 | |
| 36 | // Verify multiple insertions |
| 37 | fixture.assert_first_value( |
| 38 | "MATCH (p:Person) WHERE p.name IN ['Alice', 'Bob'] RETURN count(p) as count", |
| 39 | "count", |
| 40 | Value::Number(2.0), |
| 41 | ); |
| 42 | |
| 43 | // Test node insertion with multiple labels |
| 44 | fixture.assert_query_succeeds( |
| 45 | "INSERT (manager:Person:Employee {name: 'Manager', age: 45, role: 'supervisor'})", |
| 46 | ); |
| 47 | |
| 48 | // Test relationship insertion |
| 49 | fixture.assert_query_succeeds("INSERT (company:Company {name: 'TechCorp'})"); |
| 50 | |
| 51 | fixture.assert_query_succeeds( |
| 52 | "MATCH (p:Person {name: 'John Doe'}), (c:Company {name: 'TechCorp'}) |
| 53 | INSERT (p)-[:WORKS_FOR {since: '2020-01-01', position: 'Developer'}]->(c)", |
| 54 | ); |
| 55 | |
| 56 | // Verify relationship |
| 57 | fixture.assert_first_value( |
| 58 | "MATCH (p:Person)-[r:WORKS_FOR]->(c:Company) |
| 59 | RETURN count(r) as count", |
| 60 | "count", |
| 61 | Value::Number(1.0), |
| 62 | ); |
| 63 | |
| 64 | // Test complex pattern insertion - split into separate statements for now |
| 65 | fixture.assert_query_succeeds("INSERT (ai_proj:Project {name: 'AI System'})"); |
| 66 | |
| 67 | fixture.assert_query_succeeds( |
| 68 | "MATCH (proj:Project {name: 'AI System'}) |
| 69 | INSERT (john_lead:Person {name: 'John'})-[:ASSIGNED_TO {role: 'lead'}]->(proj)", |
| 70 | ); |
nothing calls this directly
no test coverage detected