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

Function test_dml_error_cases

graphlite/tests/dml_tests.rs:590–633  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

588
589#[test]
590fn 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]
636fn test_dml_performance() {

Callers

nothing calls this directly

Calls 4

setup_graphMethod · 0.80
assert_query_failsMethod · 0.45
assert_query_succeedsMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected