Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
benzolium committed Feb 26, 2024
1 parent 27b4d1d commit a7c3cbe
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion execution_introspection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ func TestIntrospectionQuery(t *testing.T) {
movies: [Movie!]!
somethingRandom: MovieOrCinema
somePerson: Person
}
input CinemaInput {
name: String! = "SomeName"
}
type Mutation {
createCinema(input: CinemaInput!): Cinema
}`

// Make sure schema merging doesn't break introspection
Expand Down Expand Up @@ -454,10 +462,43 @@ func TestIntrospectionQuery(t *testing.T) {
"queryType": {
"name": "Query"
},
"mutationType": null,
"mutationType": {
"name": "Mutation"
},
"subscriptionType": null
}
}
`, string(resp.Data))
})

t.Run("input fields", func(t *testing.T) {
query := gqlparser.MustLoadQuery(es.MergedSchema, `{
__type(name: "CinemaInput") {
kind
name
inputFields {
name
defaultValue
}
}
}`)
ctx := testContextWithoutVariables(query.Operations[0])
resp := es.ExecuteQuery(ctx)

require.JSONEq(t, `
{
"__type": {
"kind": "INPUT_OBJECT",
"name": "CinemaInput",
"inputFields": [
{
"name": "name",
"defaultValue": "SomeName"
}
]
}
}
`, string(resp.Data))
})

}

0 comments on commit a7c3cbe

Please sign in to comment.