@@ -269,14 +269,20 @@ async fn follow_interface_reference_invalid() {
269
269
. await
270
270
. unwrap ( ) ;
271
271
272
+ // Depending on whether `ENABLE_GRAPHQL_VALIDATIONS` is set or not, we
273
+ // get different errors
272
274
match & res. to_result ( ) . unwrap_err ( ) [ 0 ] {
273
275
QueryError :: ExecutionError ( QueryExecutionError :: ValidationError ( _, error_message) ) => {
274
276
assert_eq ! (
275
277
error_message,
276
278
"Cannot query field \" parent\" on type \" Legged\" ."
277
279
) ;
278
280
}
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) ,
280
286
}
281
287
}
282
288
@@ -1370,6 +1376,16 @@ async fn enum_list_filters() {
1370
1376
1371
1377
#[ tokio:: test]
1372
1378
async 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
+ ] ;
1373
1389
let subgraph_id = "RecursiveFragment" ;
1374
1390
let schema = "
1375
1391
type Foo @entity {
@@ -1402,7 +1418,7 @@ async fn recursive_fragment() {
1402
1418
. await
1403
1419
. unwrap ( ) ;
1404
1420
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 ( ) ) ) ;
1406
1422
1407
1423
let co_recursive = "
1408
1424
query {
@@ -1429,8 +1445,5 @@ async fn recursive_fragment() {
1429
1445
. await
1430
1446
. unwrap ( ) ;
1431
1447
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( ) ) ) ;
1436
1449
}
0 commit comments