@@ -269,14 +269,20 @@ async fn follow_interface_reference_invalid() {
269269 . await
270270 . unwrap ( ) ;
271271
272+ // Depending on whether `ENABLE_GRAPHQL_VALIDATIONS` is set or not, we
273+ // get different errors
272274 match & res. to_result ( ) . unwrap_err ( ) [ 0 ] {
273275 QueryError :: ExecutionError ( QueryExecutionError :: ValidationError ( _, error_message) ) => {
274276 assert_eq ! (
275277 error_message,
276278 "Cannot query field \" parent\" on type \" Legged\" ."
277279 ) ;
278280 }
279- e => panic ! ( "error {} is not the expected one" , e) ,
281+ QueryError :: ExecutionError ( QueryExecutionError :: UnknownField ( _, type_name, field_name) ) => {
282+ assert_eq ! ( type_name, "Legged" ) ;
283+ assert_eq ! ( field_name, "parent" ) ;
284+ }
285+ e => panic ! ( "error `{}` is not the expected one" , e) ,
280286 }
281287}
282288
@@ -1370,6 +1376,16 @@ async fn enum_list_filters() {
13701376
13711377#[ tokio:: test]
13721378async fn recursive_fragment ( ) {
1379+ // Depending on whether `ENABLE_GRAPHQL_VALIDATIONS` is set or not, we
1380+ // get different error messages
1381+ const FOO_ERRORS : [ & str ; 2 ] = [
1382+ "Cannot spread fragment \" FooFrag\" within itself." ,
1383+ "query has fragment cycle including `FooFrag`" ,
1384+ ] ;
1385+ const FOO_BAR_ERRORS : [ & str ; 2 ] = [
1386+ "Cannot spread fragment \" BarFrag\" within itself via \" FooFrag\" ." ,
1387+ "query has fragment cycle including `BarFrag`" ,
1388+ ] ;
13731389 let subgraph_id = "RecursiveFragment" ;
13741390 let schema = "
13751391 type Foo @entity {
@@ -1402,7 +1418,7 @@ async fn recursive_fragment() {
14021418 . await
14031419 . unwrap ( ) ;
14041420 let data = res. to_result ( ) . unwrap_err ( ) [ 0 ] . to_string ( ) ;
1405- assert_eq ! ( data, "Cannot spread fragment \" FooFrag \" within itself." ) ;
1421+ assert ! ( FOO_ERRORS . contains ( & data. as_str ( ) ) ) ;
14061422
14071423 let co_recursive = "
14081424 query {
@@ -1429,8 +1445,5 @@ async fn recursive_fragment() {
14291445 . await
14301446 . unwrap ( ) ;
14311447 let data = res. to_result ( ) . unwrap_err ( ) [ 0 ] . to_string ( ) ;
1432- assert_eq ! (
1433- data,
1434- "Cannot spread fragment \" BarFrag\" within itself via \" FooFrag\" ."
1435- ) ;
1448+ assert ! ( FOO_BAR_ERRORS . contains( & data. as_str( ) ) ) ;
14361449}
0 commit comments