()
| 220 | |
| 221 | #[test] |
| 222 | fn test_select_statement_operations() { |
| 223 | let fixture = TestFixture::new().expect("Failed to create test fixture"); |
| 224 | // Setup fresh graph for this test to avoid interference |
| 225 | fixture |
| 226 | .setup_graph("test_select_statement_operations") |
| 227 | .expect("Failed to setup graph"); |
| 228 | // Re-insert fraud data since we have a fresh graph |
| 229 | fixture |
| 230 | .insert_fraud_data() |
| 231 | .expect("Failed to insert fraud data"); |
| 232 | |
| 233 | // Test basic SELECT |
| 234 | let result = fixture.assert_query_succeeds( |
| 235 | "SELECT count(*) as total_nodes |
| 236 | FROM MATCH (n)", |
| 237 | ); |
| 238 | assert_eq!(result.rows.len(), 1); |
| 239 | |
| 240 | // Test SELECT with WHERE |
| 241 | let result = fixture.assert_query_succeeds( |
| 242 | "SELECT a.id, a.balance |
| 243 | FROM MATCH (a:Account) |
| 244 | WHERE a.balance > 1000 |
| 245 | ORDER BY a.balance DESC |
| 246 | LIMIT 10", |
| 247 | ); |
| 248 | assert!(result.rows.len() <= 10); |
| 249 | |
| 250 | // Test SELECT DISTINCT |
| 251 | let result = fixture.assert_query_succeeds( |
| 252 | "SELECT DISTINCT m.category |
| 253 | FROM MATCH (m:Merchant) |
| 254 | ORDER BY m.category", |
| 255 | ); |
| 256 | assert!(!result.rows.is_empty()); |
| 257 | |
| 258 | // Test SELECT with JOIN-like patterns |
| 259 | let result = fixture.assert_query_succeeds( |
| 260 | "SELECT a.id, m.name, t.amount |
| 261 | FROM MATCH (a:Account)-[t:Transaction]->(m:Merchant) |
| 262 | WHERE t.amount > 10 |
| 263 | ORDER BY t.amount DESC |
| 264 | LIMIT 20", |
| 265 | ); |
| 266 | assert!(result.rows.len() <= 20); |
| 267 | |
| 268 | // Test SELECT with GROUP BY |
| 269 | let result = fixture.assert_query_succeeds( |
| 270 | "SELECT m.category, count(*) as merchant_count |
| 271 | FROM MATCH (m:Merchant) |
| 272 | GROUP BY m.category |
| 273 | ORDER BY merchant_count DESC", |
| 274 | ); |
| 275 | assert!(!result.rows.is_empty()); |
| 276 | |
| 277 | // Test SELECT with HAVING |
| 278 | let result = fixture.assert_query_succeeds( |
| 279 | "SELECT a.status, count(*) as account_count |
nothing calls this directly
no test coverage detected