Skip to content

Commit db1b6cc

Browse files
committed
Extra test to show mixed queries stop hard
1 parent c032d57 commit db1b6cc

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎src/test/groovy/graphql/introspection/IntrospectionTest.groovy‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,32 @@ class IntrospectionTest extends Specification {
745745
er.errors[0].getErrorType() == ErrorType.IntrospectionDisabled
746746
}
747747

748+
def "mixed schema and other fields stop early"() {
749+
def graphQL = TestUtil.graphQL("type Query { normalField : String } ").build()
750+
751+
def query = """
752+
query goodAndBad {
753+
normalField
754+
__schema{ types{ fields { name }}}
755+
}
756+
"""
757+
758+
when:
759+
def er = graphQL.execute(query)
760+
761+
then:
762+
er.errors.isEmpty()
763+
764+
when:
765+
Introspection.enabledJvmWide(false)
766+
er = graphQL.execute(query)
767+
768+
then:
769+
er.errors[0] instanceof IntrospectionDisabledError
770+
er.errors[0].getErrorType() == ErrorType.IntrospectionDisabled
771+
er.data == null // stops hard
772+
}
773+
748774
def "AsyncSerialExecutionStrategy with jvm wide enablement"() {
749775
def graphQL = TestUtil.graphQL("type Query { f : String } ")
750776
.queryExecutionStrategy(new AsyncSerialExecutionStrategy()).build()

0 commit comments

Comments
 (0)