summaryrefslogtreecommitdiff
path: root/tests/Language/GraphQL
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2021-06-18 06:51:14 +0200
committerEugen Wissner <belka@caraus.de>2021-06-18 06:51:14 +0200
commit6fe9eb72e42fb4ae36435324148e8f96e871a26c (patch)
treebc0e10cb452702ea103a710575a404eda4b3dc4b /tests/Language/GraphQL
parent2ce2be5d917091872b45b650b60ac2a23f544916 (diff)
downloadgraphql-6fe9eb72e42fb4ae36435324148e8f96e871a26c.tar.gz
Fix merging fields with arguments
executeField shouldn't assume that a selection has only one field with a given name, but it should take the first field. The underlying cause is a wrong pattern, which (because of the laziness) is executed only if the field has arguments.
Diffstat (limited to 'tests/Language/GraphQL')
-rw-r--r--tests/Language/GraphQL/ExecuteSpec.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/Language/GraphQL/ExecuteSpec.hs b/tests/Language/GraphQL/ExecuteSpec.hs
index 815e315..a31b0a2 100644
--- a/tests/Language/GraphQL/ExecuteSpec.hs
+++ b/tests/Language/GraphQL/ExecuteSpec.hs
@@ -21,7 +21,9 @@ import Language.GraphQL.Error
import Language.GraphQL.Execute (execute)
import qualified Language.GraphQL.Type.Schema as Schema
import Language.GraphQL.Type
+import qualified Language.GraphQL.Type.In as In
import qualified Language.GraphQL.Type.Out as Out
+import Prelude hiding (id)
import Test.Hspec (Spec, context, describe, it, shouldBe)
import Text.Megaparsec (parse)
import Text.RawString.QQ (r)
@@ -43,7 +45,9 @@ queryType = Out.ObjectType "Query" Nothing []
$ pure $ Object mempty
where
philosopherField =
- Out.Field Nothing (Out.NonNullObjectType philosopherType) HashMap.empty
+ Out.Field Nothing (Out.NonNullObjectType philosopherType)
+ $ HashMap.singleton "id"
+ $ In.Argument Nothing (In.NamedScalarType id) Nothing
musicType :: Out.ObjectType (Either SomeException)
musicType = Out.ObjectType "Music" Nothing []