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

Function test_set_operations

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

Source from the content-addressed store, hash-verified

72
73#[test]
74fn test_set_operations() {
75 let fixture = TestFixture::new().expect("Failed to create test fixture");
76 // Setup fresh graph for this test to avoid interference
77 fixture
78 .setup_graph("test_set_operations")
79 .expect("Failed to setup graph");
80
81 // Insert test data first
82 fixture.assert_query_succeeds(
83 "INSERT (emp:Employee {name: 'Jane Smith', age: 30, salary: 50000})",
84 );
85
86 // Test property SET
87 fixture.assert_query_succeeds(
88 "MATCH (emp:Employee {name: 'Jane Smith'})
89 SET emp.age = 31, emp.salary = 55000",
90 );
91
92 // Verify property update
93 let result = fixture.assert_query_succeeds(
94 "MATCH (emp:Employee {name: 'Jane Smith'})
95 RETURN emp.age as age, emp.salary as salary",
96 );
97 assert_eq!(result.rows.len(), 1);
98
99 // Test adding new property
100 fixture.assert_query_succeeds(
101 "MATCH (emp:Employee {name: 'Jane Smith'})
102 SET emp.department = 'Engineering', emp.active = true",
103 );
104
105 // Verify new property
106 fixture.assert_first_value(
107 "MATCH (emp:Employee {name: 'Jane Smith'})
108 RETURN emp.department as dept",
109 "dept",
110 Value::String("Engineering".to_string()),
111 );
112
113 // Test label SET
114 fixture.assert_query_succeeds(
115 "MATCH (emp:Employee {name: 'Jane Smith'})
116 SET emp:Manager",
117 );
118
119 // Verify label addition
120 fixture.assert_first_value(
121 "MATCH (emp:Employee:Manager {name: 'Jane Smith'})
122 RETURN count(emp) as count",
123 "count",
124 Value::Number(1.0),
125 );
126
127 // Test conditional SET
128 fixture.assert_query_succeeds(
129 "MATCH (emp:Employee)
130 WHERE emp.salary > 50000
131 SET emp.performance_tier = 'high'",

Callers

nothing calls this directly

Calls 3

setup_graphMethod · 0.80
assert_first_valueMethod · 0.80
assert_query_succeedsMethod · 0.45

Tested by

no test coverage detected