@@ -184,8 +184,7 @@ fn from_connect_fetchone_address() {
184184
185185#[ test]
186186#[ serial]
187- #[ should_panic( expected = "explicit panic" ) ]
188- fn from_connect_fetchone_explicit_panic ( ) {
187+ fn from_connect_fetchone_no_data ( ) {
189188 initialize ( ) ;
190189 execute_query ( String :: from (
191190 "CREATE (u:User {name: 'Alice'})-[:Likes]->(m:Software {name: 'Memgraph'})" ,
@@ -200,39 +199,19 @@ fn from_connect_fetchone_explicit_panic() {
200199 ..Default :: default ( )
201200 } ;
202201 let mut connection = get_connection ( connect_prms) ;
203- let params = get_params ( "name" . to_string ( ) , "Alice " . to_string ( ) ) ;
202+ let params = get_params ( "name" . to_string ( ) , "Something " . to_string ( ) ) ;
204203
205204 let query = String :: from ( "MATCH (n:User) WHERE n.name = $name RETURN n LIMIT 5" ) ;
206205 match connection. execute ( & query, Some ( & params) ) {
207206 Ok ( x) => x,
208207 Err ( err) => panic ! ( "Query failed: {}" , err) ,
209208 } ;
210- connection. results_iter = None ;
211- loop {
212- match connection. fetchone ( ) {
213- Ok ( res) => match res {
214- Some ( x) => {
215- for val in & x. values {
216- let values = vec ! [ String :: from( "User" ) ] ;
217- let mg_map = hashmap ! {
218- String :: from( "name" ) => Value :: String ( "Alice" . to_string( ) ) ,
219- } ;
220- let node = Value :: Node ( Node {
221- id : match val {
222- Value :: Node ( x) => x. id ,
223- _ => 1 ,
224- } ,
225- label_count : 1 ,
226- labels : values,
227- properties : mg_map,
228- } ) ;
229- assert_eq ! ( & node, val) ;
230- }
231- }
232- None => break ,
233- } ,
234- Err ( err) => panic ! ( "Fetch failed: {}" , err) ,
235- }
209+
210+ let first = connection. fetchone ( ) ;
211+ if let Ok ( rec) = first {
212+ assert ! ( rec. is_none( ) ) ;
213+ } else {
214+ panic ! ( "First fetched record should be None" )
236215 }
237216}
238217
0 commit comments