@@ -838,6 +838,42 @@ async fn test_non_fatal_errors(ctx: TestContext) -> anyhow::Result<()> {
838838 Ok ( ( ) )
839839}
840840
841+ async fn test_empty_subgraph_features ( ctx : TestContext ) -> anyhow:: Result < ( ) > {
842+ let subgraph = ctx. subgraph ;
843+ let query = "query GetEmptySubgraphFeatures() {
844+ subgraphFeatures(subgraphs: []) {
845+ subgraph
846+ specVersion
847+ apiVersion
848+ features
849+ dataSources
850+ network
851+ handlers
852+ }
853+ }" ;
854+
855+ let resp = subgraph. query ( query) . await ?;
856+
857+ // The response is now an array, get the first element
858+ let features_array = & resp[ "data" ] [ "subgraphFeatures" ] ;
859+ assert ! (
860+ features_array. is_array( ) ,
861+ "subgraphFeatures must return an array"
862+ ) ;
863+ assert_eq ! (
864+ features_array. as_array( ) . unwrap( ) . len( ) ,
865+ 0 ,
866+ "Expected exactly zero subgraph feature set"
867+ ) ;
868+
869+ let exp = json ! ( {
870+ "subgraphFeatures" : [ ]
871+ } ) ;
872+ assert_eq ! ( & exp, & resp[ "data" ] ) ;
873+
874+ Ok ( ( ) )
875+ }
876+
841877async fn test_overloaded_functions ( ctx : TestContext ) -> anyhow:: Result < ( ) > {
842878 let subgraph = ctx. subgraph ;
843879 // all overloads of the contract function are called
@@ -1132,6 +1168,7 @@ async fn integration_tests() -> anyhow::Result<()> {
11321168 TestCase :: new( "reverted-calls" , test_reverted_calls_are_indexed) ,
11331169 TestCase :: new( "host-exports" , test_host_exports) ,
11341170 TestCase :: new( "non-fatal-errors" , test_non_fatal_errors) ,
1171+ TestCase :: new( "non-fatal-errors" , test_empty_subgraph_features) ,
11351172 TestCase :: new( "overloaded-functions" , test_overloaded_functions) ,
11361173 TestCase :: new( "poi-for-failed-subgraph" , test_poi_for_failed_subgraph) ,
11371174 TestCase :: new( "remove-then-update" , test_remove_then_update) ,
0 commit comments