Skip to content

Commit 848f19b

Browse files
author
gursajan
committed
added removed test
1 parent 1f7ca4a commit 848f19b

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

src/test/groovy/graphql/introspection/IntrospectionResultToSchemaTest.groovy

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,76 @@ type Droid implements Character {
437437
"""
438438
}
439439

440+
def "test simpsons introspection result"() {
441+
given:
442+
String simpsons = this.getClass().getResource('/simpsons-introspection.json').text
443+
444+
def parsed = slurp(simpsons)
445+
446+
when:
447+
Document document = introspectionResultToSchema.createSchemaDefinition(parsed)
448+
def result = printAst(document)
449+
450+
then:
451+
result == """schema {
452+
query: QueryType
453+
mutation: MutationType
454+
}
455+
456+
type QueryType {
457+
character(firstName: String): Character
458+
characters: [Character]
459+
episodes: [Episode]
460+
search(searchFor: String): [Everything]
461+
}
462+
463+
type Character {
464+
id: ID!
465+
firstName: String
466+
lastName: String
467+
family: Boolean
468+
episodes: [Episode]
469+
}
470+
471+
type Episode {
472+
id: ID!
473+
name: String
474+
season: Season
475+
number: Int
476+
numberOverall: Int
477+
characters: [Character]
478+
}
479+
480+
" Simpson seasons"
481+
enum Season {
482+
Season1
483+
Season2
484+
Season3
485+
Season4
486+
Season5
487+
Season6
488+
Season7
489+
Season8
490+
Season9
491+
}
492+
493+
union Everything = Character | Episode
494+
495+
type MutationType {
496+
addCharacter(character: CharacterInput): MutationResult
497+
}
498+
499+
type MutationResult {
500+
success: Boolean
501+
}
502+
503+
input CharacterInput {
504+
firstName: String
505+
lastName: String
506+
family: Boolean
507+
}
508+
"""
509+
}
440510

441511
def "test complete round trip"() {
442512
given:

0 commit comments

Comments
 (0)