@@ -203,24 +203,47 @@ class EngineRunningTest extends Specification {
203203 def sdl = '''
204204
205205 type Query {
206- hello: String
206+ hello: String
207207 hello2: String
208+ foo: Foo
209+ someStaticValue: Bar
210+ }
211+ type Foo {
212+ name: String
213+ }
214+ type Bar {
215+ staticValue: String
208216 }
209217 '''
210218 CompletableFuture cf1 = new CompletableFuture ();
219+ CompletableFuture cf2 = new CompletableFuture ();
220+ CompletableFuture cfFooName = new CompletableFuture ();
211221 def df1 = { env ->
212222 return cf1;
213223 } as DataFetcher
214- CompletableFuture cf2 = new CompletableFuture ();
224+
215225 def df2 = { env ->
216226 return cf2;
217227 } as DataFetcher
218228
219- def fetchers = [" Query" : [" hello" : df1, " hello2" : df2]]
229+ def dfFoo = { env ->
230+ return " Foo" ;
231+ } as DataFetcher
232+
233+ def dfFooName = { env ->
234+ return cfFooName;
235+ } as DataFetcher
236+
237+ def dfStaticValue = { env ->
238+ return [staticValue : " staticValue" ]
239+ } as DataFetcher
240+
241+
242+ def fetchers = [Query : [" hello" : df1, " hello2" : df2, foo : dfFoo, someStaticValue : dfStaticValue], Foo : [name : dfFooName]]
220243 def schema = TestUtil . schema(sdl, fetchers)
221244 def graphQL = GraphQL . newGraphQL(schema). build()
222245
223- def query = " { hello hello2 }"
246+ def query = " { hello hello2 foo { name } someStaticValue {staticValue} }"
224247 def ei = newExecutionInput(query). build()
225248
226249 List<RunningState > states = trackStates(ei)
@@ -233,17 +256,22 @@ class EngineRunningTest extends Specification {
233256 when :
234257 states. clear();
235258 cf1. complete(" world" )
259+ then :
260+ states == [RUNNING , NOT_RUNNING ]
236261
262+ when :
263+ states. clear();
264+ cfFooName. complete(" FooName" )
237265 then :
238266 states == [RUNNING , NOT_RUNNING ]
239267
268+
240269 when :
241270 states. clear()
242271 cf2. complete(" world2" )
243-
244272 then :
245273 states == [RUNNING , NOT_RUNNING ]
246- er. get(). data == [hello : " world" , hello2 : " world2" ]
274+ er. get(). data == [hello : " world" , hello2 : " world2" , foo : [ name : " FooName " ], someStaticValue : [ staticValue : " staticValue " ] ]
247275 }
248276
249277
0 commit comments