diff options
| author | Eugen Wissner <belka@caraus.de> | 2020-06-07 06:16:45 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2020-06-07 06:16:45 +0200 |
| commit | 377c87045e468b9a34e7bee40129fcd03e519968 (patch) | |
| tree | 2489f6fdf413c0869a7143fa7677a7077bc133fc /tests | |
| parent | 4c9264c12c15d52e40a245b21acaa70f76cc9ba4 (diff) | |
| download | graphql-377c87045e468b9a34e7bee40129fcd03e519968.tar.gz | |
Add description to the enum type values
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Language/GraphQL/Execute/CoerceSpec.hs | 9 | ||||
| -rw-r--r-- | tests/Test/StarWars/Schema.hs | 10 |
2 files changed, 13 insertions, 6 deletions
diff --git a/tests/Language/GraphQL/Execute/CoerceSpec.hs b/tests/Language/GraphQL/Execute/CoerceSpec.hs index 15180fb..d800230 100644 --- a/tests/Language/GraphQL/Execute/CoerceSpec.hs +++ b/tests/Language/GraphQL/Execute/CoerceSpec.hs @@ -9,7 +9,6 @@ import qualified Data.Aeson.Types as Aeson import qualified Data.HashMap.Strict as HashMap import Data.Maybe (isNothing) import Data.Scientific (scientific) -import qualified Data.Set as Set import Language.GraphQL.Execute.Coerce import Language.GraphQL.Type.Definition import qualified Language.GraphQL.Type.In as In @@ -17,8 +16,12 @@ import Prelude hiding (id) import Test.Hspec (Spec, describe, it, shouldBe, shouldSatisfy) direction :: EnumType -direction = EnumType "Direction" Nothing - $ Set.fromList ["NORTH", "EAST", "SOUTH", "WEST"] +direction = EnumType "Direction" Nothing $ HashMap.fromList + [ ("NORTH", EnumValue Nothing) + , ("EAST", EnumValue Nothing) + , ("SOUTH", EnumValue Nothing) + , ("WEST", EnumValue Nothing) + ] singletonInputObject :: In.Type singletonInputObject = In.NamedInputObjectType type' diff --git a/tests/Test/StarWars/Schema.hs b/tests/Test/StarWars/Schema.hs index d787a07..6296461 100644 --- a/tests/Test/StarWars/Schema.hs +++ b/tests/Test/StarWars/Schema.hs @@ -11,7 +11,6 @@ import Data.Functor.Identity (Identity) import qualified Data.HashMap.Strict as HashMap import Data.Maybe (catMaybes) import Data.Text (Text) -import qualified Data.Set as Set import Language.GraphQL.Trans import Language.GraphQL.Type.Definition import qualified Language.GraphQL.Type.In as In @@ -86,8 +85,13 @@ idField f = do pure $ v' HashMap.! f episodeEnum :: EnumType -episodeEnum = EnumType "Episode" Nothing - $ Set.fromList ["NEW_HOPE", "EMPIRE", "JEDI"] +episodeEnum = EnumType "Episode" (Just description) + $ HashMap.fromList [newHope, empire, jedi] + where + description = "One of the films in the Star Wars Trilogy" + newHope = ("NEW_HOPE", EnumValue $ Just "Released in 1977.") + empire = ("EMPIRE", EnumValue $ Just "Released in 1980.") + jedi = ("JEDI", EnumValue $ Just "Released in 1983.") hero :: ActionT Identity Value hero = do |
