()
| 588 | |
| 589 | #[test] |
| 590 | fn test_dml_error_cases() { |
| 591 | let fixture = TestFixture::new().expect("Failed to create test fixture"); |
| 592 | fixture |
| 593 | .setup_graph("test_error_cases") |
| 594 | .expect("Failed to setup graph"); |
| 595 | |
| 596 | // Test invalid INSERT syntax |
| 597 | fixture.assert_query_fails("INSERT (invalid syntax here)", "Parse error"); |
| 598 | |
| 599 | // Test SET on non-existent nodes (should succeed but affect 0 nodes) |
| 600 | fixture.assert_query_succeeds("MATCH (n:NonExistentLabel) SET n.prop = 'value'"); |
| 601 | |
| 602 | // Test REMOVE on non-existent properties (should succeed) |
| 603 | fixture.assert_query_succeeds("INSERT (test:RemoveTest {prop1: 'value'})"); |
| 604 | |
| 605 | fixture.assert_query_succeeds("MATCH (test:RemoveTest) REMOVE test.non_existent_prop"); |
| 606 | |
| 607 | // Test DELETE with missing DETACH when node has relationships |
| 608 | // TODO: This test is disabled because MATCH INSERT is not working properly |
| 609 | // The MATCH INSERT operation fails to create relationships, so the DELETE constraint check |
| 610 | // cannot be properly tested. Once MATCH INSERT is fixed, re-enable this test. |
| 611 | /* |
| 612 | fixture.assert_query_succeeds( |
| 613 | "INSERT (connected:Connected {id: 1}), (other:Other {id: 2})" |
| 614 | ); |
| 615 | |
| 616 | fixture.assert_query_succeeds( |
| 617 | "MATCH (c:Connected), (o:Other) INSERT (c)-[:LINKS_TO]->(o)" |
| 618 | ); |
| 619 | |
| 620 | fixture.assert_query_fails( |
| 621 | "MATCH (c:Connected) DELETE c", |
| 622 | "Cannot delete node" |
| 623 | ); |
| 624 | */ |
| 625 | |
| 626 | // Test type mismatches in SET operations |
| 627 | fixture.assert_query_succeeds("INSERT (type_test:TypeTest {number_prop: 42})"); |
| 628 | |
| 629 | // This may or may not fail depending on type coercion rules |
| 630 | let result = fixture.query("MATCH (t:TypeTest) SET t.number_prop = 'string_value'"); |
| 631 | |
| 632 | if result.is_ok() {} |
| 633 | } |
| 634 | |
| 635 | #[test] |
| 636 | fn test_dml_performance() { |
nothing calls this directly
no test coverage detected