From a7c3cbeaf10c3a166a9dad720704ee8ade63d433 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 26 Feb 2024 17:10:07 +0300 Subject: [PATCH] add test --- execution_introspection_test.go | 43 ++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/execution_introspection_test.go b/execution_introspection_test.go index 9a290b1e..9f667c60 100644 --- a/execution_introspection_test.go +++ b/execution_introspection_test.go @@ -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 @@ -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)) + }) + }