@@ -838,6 +838,42 @@ async fn test_non_fatal_errors(ctx: TestContext) -> anyhow::Result<()> {
838
838
Ok ( ( ) )
839
839
}
840
840
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
+
841
877
async fn test_overloaded_functions ( ctx : TestContext ) -> anyhow:: Result < ( ) > {
842
878
let subgraph = ctx. subgraph ;
843
879
// all overloads of the contract function are called
@@ -1132,6 +1168,7 @@ async fn integration_tests() -> anyhow::Result<()> {
1132
1168
TestCase :: new( "reverted-calls" , test_reverted_calls_are_indexed) ,
1133
1169
TestCase :: new( "host-exports" , test_host_exports) ,
1134
1170
TestCase :: new( "non-fatal-errors" , test_non_fatal_errors) ,
1171
+ TestCase :: new( "non-fatal-errors" , test_empty_subgraph_features) ,
1135
1172
TestCase :: new( "overloaded-functions" , test_overloaded_functions) ,
1136
1173
TestCase :: new( "poi-for-failed-subgraph" , test_poi_for_failed_subgraph) ,
1137
1174
TestCase :: new( "remove-then-update" , test_remove_then_update) ,
0 commit comments