11package graphql.execution.directives
22
33import com.google.common.collect.ImmutableList
4+ import graphql.ExecutionInput
45import graphql.ExecutionResult
56import graphql.GraphQL
67import graphql.GraphQLContext
@@ -14,6 +15,7 @@ import graphql.execution.instrumentation.parameters.InstrumentationExecuteOperat
1415import graphql.language.Document
1516import graphql.language.OperationDefinition
1617import graphql.schema.GraphQLScalarType
18+ import graphql.util.FpKit
1719import spock.lang.Specification
1820
1921class OperationDirectivesResolverTest extends Specification {
@@ -139,11 +141,17 @@ class OperationDirectivesResolverTest extends Specification {
139141 def graphQL = GraphQL . newGraphQL(schema). instrumentation(instrumentation). build()
140142
141143 when :
142- graphQL . execute ("""
144+ def ei = ExecutionInput . newExecutionInput ("""
143145 query q1 @timeout(ms : 100) @foo @bar @baz @baz {
144146 f
145147 }
146- """ )
148+
149+ mutation m1 @timeout(ms : 100) @foo @bar @baz @baz {
150+ f
151+ }
152+ """ ). operationName(" q1" ). build()
153+ graphQL. execute(ei)
154+
147155
148156 then :
149157 def resolveDirectives = executionContext. getOperationDirectives()
@@ -157,6 +165,15 @@ class OperationDirectivesResolverTest extends Specification {
157165 then :
158166 commonIntegrationAsserts(enoResolveDirectives)
159167
168+ when :
169+ def allOperationDirectives = executionContext. getAllOperationDirectives()
170+
171+ then :
172+ allOperationDirectives. size() == 2
173+ ImmutableList<QueryAppliedDirective > firstList = allOperationDirectives. values(). iterator(). next()
174+ def firstResolvedDirectives = FpKit . groupingBy(firstList, { it -> it. name })
175+ commonIntegrationAsserts(firstResolvedDirectives)
176+
160177 }
161178
162179 private static boolean commonIntegrationAsserts (Map<String , ImmutableList<QueryAppliedDirective > > resolveDirectives ) {
0 commit comments