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

Function test_remove_operations

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

Source from the content-addressed store, hash-verified

140
141#[test]
142fn test_remove_operations() {
143 let fixture = TestFixture::new().expect("Failed to create test fixture");
144 // Setup fresh graph for this test to avoid interference
145 fixture
146 .setup_graph("test_remove_operations")
147 .expect("Failed to setup graph");
148
149 // Insert test data
150 fixture.assert_query_succeeds(
151 "INSERT (temp:TempNode:ExtraLabel {prop1: 'value1', prop2: 'value2', prop3: 'value3'})",
152 );
153
154 // Test property REMOVE
155 fixture.assert_query_succeeds(
156 "MATCH (temp:TempNode)
157 REMOVE temp.prop1, temp.prop2",
158 );
159
160 // Verify properties removed
161 fixture.assert_first_value(
162 "MATCH (temp:TempNode)
163 RETURN temp.prop3 as remaining_prop",
164 "remaining_prop",
165 Value::String("value3".to_string()),
166 );
167
168 // Test label REMOVE
169 fixture.assert_query_succeeds(
170 "MATCH (temp:TempNode:ExtraLabel)
171 REMOVE temp:ExtraLabel",
172 );
173
174 // Verify label removed (node should still exist with TempNode label)
175 fixture.assert_first_value(
176 "MATCH (temp:TempNode)
177 WHERE NOT temp:ExtraLabel
178 RETURN count(temp) as count",
179 "count",
180 Value::Number(1.0),
181 );
182
183 // Test conditional REMOVE
184 fixture.assert_query_succeeds(
185 "INSERT (conditional:ConditionalNode {status: 'temporary', value: 100})",
186 );
187
188 fixture.assert_query_succeeds(
189 "MATCH (c:ConditionalNode)
190 WHERE c.status = 'temporary'
191 REMOVE c.status",
192 );
193
194 // Verify conditional remove
195 let result = fixture
196 .query(
197 "MATCH (c:ConditionalNode)
198 RETURN c.status as status",
199 )

Callers

nothing calls this directly

Calls 5

setup_graphMethod · 0.80
assert_first_valueMethod · 0.80
unwrapMethod · 0.80
assert_query_succeedsMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected