@@ -6,8 +6,8 @@ use graph::components::store::SubgraphStore;
66use graph:: prelude:: DeploymentHash ;
77use serde:: Deserialize ;
88use serde_json:: json;
9+ use test_store:: create_test_subgraph;
910use test_store:: SUBGRAPH_STORE ;
10- use test_store:: { create_subgraph_name, create_test_subgraph} ;
1111use tokio:: time:: sleep;
1212
1313use self :: util:: client:: send_graphql_request;
@@ -358,8 +358,6 @@ fn graphql_cannot_create_new_subgraph_with_invalid_name() {
358358#[ test]
359359fn graphql_can_remove_subgraph ( ) {
360360 run_test ( || async {
361- create_subgraph_name ( "subgraph_1" ) . await . unwrap ( ) ;
362-
363361 let resp = send_graphql_request (
364362 json ! ( {
365363 "query" : r#"mutation RemoveSubgraph {
@@ -405,44 +403,17 @@ fn graphql_cannot_remove_subgraph_with_invalid_name() {
405403 )
406404 . await ;
407405
408- let data = & resp[ "data" ] [ "deployment" ] ;
409- let errors = resp[ "errors" ] . as_array ( ) . unwrap ( ) ;
410-
411- assert ! ( data. is_null( ) ) ;
412- assert_eq ! ( errors. len( ) , 1 ) ;
413- assert_eq ! (
414- errors[ 0 ] [ "message" ] . as_str( ) . unwrap( ) ,
415- "store error: Subgraph name must contain only a-z, A-Z, 0-9, '-' and '_'"
416- ) ;
417- } ) ;
418- }
419-
420- #[ test]
421- fn graphql_remove_returns_error_for_non_existing_subgraph ( ) {
422- run_test ( || async {
423- let resp = send_graphql_request (
424- json ! ( {
425- "query" : r#"mutation RemoveNonExistingSubgraph {
426- deployment {
427- remove(name: "non_existing_subgraph") {
428- success
429- }
406+ let success_resp = json ! ( {
407+ "data" : {
408+ "deployment" : {
409+ "remove" : {
410+ "success" : true ,
430411 }
431- }"#
432- } ) ,
433- VALID_TOKEN ,
434- )
435- . await ;
436-
437- let data = & resp[ "data" ] [ "deployment" ] ;
438- let errors = resp[ "errors" ] . as_array ( ) . unwrap ( ) ;
412+ }
413+ }
414+ } ) ;
439415
440- assert ! ( data. is_null( ) ) ;
441- assert_eq ! ( errors. len( ) , 1 ) ;
442- assert_eq ! (
443- errors[ 0 ] [ "message" ] . as_str( ) . unwrap( ) ,
444- "store error: subgraph not found: non_existing_subgraph"
445- ) ;
416+ assert_ne ! ( resp, success_resp) ;
446417 } ) ;
447418}
448419
0 commit comments