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

Function test_optional_patterns

graphlite/tests/pattern_tests.rs:228–266  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

226
227#[test]
228fn test_optional_patterns() {
229 let fixture = TestFixture::with_fraud_data().expect("Failed to create test fixture");
230
231 // Test simple LIMIT clause functionality
232 let result = fixture.assert_query_succeeds(
233 "MATCH (a:Account)
234 RETURN a.account_number
235 LIMIT 10",
236 );
237 assert!(result.rows.len() <= 10);
238
239 // Test conditional pattern matching with WHERE clause
240 let result = fixture.assert_query_succeeds(
241 "MATCH (a:Account)-[t:Transaction]->(m:Merchant)
242 WHERE t.amount > 50000
243 RETURN DISTINCT a.account_number
244 LIMIT 15",
245 );
246 assert!(result.rows.len() <= 15);
247
248 // Test pattern with conditional existence using separate matches
249 let result = fixture.assert_query_succeeds(
250 "MATCH (a:Account)
251 RETURN a.account_number,
252 EXISTS {MATCH (a)-[t:Transaction]->(m:Merchant)} as has_transactions
253 LIMIT 10",
254 );
255 // Verify the query executed successfully and returned results
256 assert!(!result.rows.is_empty());
257
258 // Test filtering patterns with high-value transactions
259 let result = fixture.assert_query_succeeds(
260 "MATCH (m:Merchant)<-[t:Transaction]-(a:Account)
261 WHERE t.amount > 10000
262 RETURN DISTINCT m.name
263 LIMIT 10",
264 );
265 assert!(result.rows.len() <= 10);
266}
267
268#[test]
269fn test_pattern_comprehensions() {

Callers

nothing calls this directly

Calls 1

assert_query_succeedsMethod · 0.45

Tested by

no test coverage detected