summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-08-22 06:39:52 +0200
committerEugen Wissner <belka@caraus.de>2020-08-22 06:39:52 +0200
commit54dbf1df16038c9f583c1b53ab4fac1d71b194fd (patch)
treed6a112c10e5537a1530196aa4e8951e6fce6e464 /tests
parent1a788a62611fcb3b044f37880a68147989dc5e18 (diff)
downloadgraphql-54dbf1df16038c9f583c1b53ab4fac1d71b194fd.tar.gz
Remove encoder test based on old external files
Diffstat (limited to 'tests')
-rw-r--r--tests/Language/GraphQL/ErrorSpec.hs4
-rw-r--r--tests/Language/GraphQL/Execute/CoerceSpec.hs4
-rw-r--r--tests/Language/GraphQL/Type/OutSpec.hs4
-rw-r--r--tests/Test/KitchenSinkSpec.hs69
-rw-r--r--tests/data/kitchen-sink.graphql38
-rw-r--r--tests/data/kitchen-sink.min.graphql1
6 files changed, 12 insertions, 108 deletions
diff --git a/tests/Language/GraphQL/ErrorSpec.hs b/tests/Language/GraphQL/ErrorSpec.hs
index 482dc3a..1497c48 100644
--- a/tests/Language/GraphQL/ErrorSpec.hs
+++ b/tests/Language/GraphQL/ErrorSpec.hs
@@ -1,3 +1,7 @@
+{- This Source Code Form is subject to the terms of the Mozilla Public License,
+ v. 2.0. If a copy of the MPL was not distributed with this file, You can
+ obtain one at https://mozilla.org/MPL/2.0/. -}
+
{-# LANGUAGE OverloadedStrings #-}
module Language.GraphQL.ErrorSpec
( spec
diff --git a/tests/Language/GraphQL/Execute/CoerceSpec.hs b/tests/Language/GraphQL/Execute/CoerceSpec.hs
index 339c2e3..2b00895 100644
--- a/tests/Language/GraphQL/Execute/CoerceSpec.hs
+++ b/tests/Language/GraphQL/Execute/CoerceSpec.hs
@@ -1,3 +1,7 @@
+{- This Source Code Form is subject to the terms of the Mozilla Public License,
+ v. 2.0. If a copy of the MPL was not distributed with this file, You can
+ obtain one at https://mozilla.org/MPL/2.0/. -}
+
{-# LANGUAGE OverloadedStrings #-}
module Language.GraphQL.Execute.CoerceSpec
( spec
diff --git a/tests/Language/GraphQL/Type/OutSpec.hs b/tests/Language/GraphQL/Type/OutSpec.hs
index eecc374..733763d 100644
--- a/tests/Language/GraphQL/Type/OutSpec.hs
+++ b/tests/Language/GraphQL/Type/OutSpec.hs
@@ -1,3 +1,7 @@
+{- This Source Code Form is subject to the terms of the Mozilla Public License,
+ v. 2.0. If a copy of the MPL was not distributed with this file, You can
+ obtain one at https://mozilla.org/MPL/2.0/. -}
+
{-# LANGUAGE OverloadedStrings #-}
module Language.GraphQL.Type.OutSpec
( spec
diff --git a/tests/Test/KitchenSinkSpec.hs b/tests/Test/KitchenSinkSpec.hs
deleted file mode 100644
index 9f5a947..0000000
--- a/tests/Test/KitchenSinkSpec.hs
+++ /dev/null
@@ -1,69 +0,0 @@
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE QuasiQuotes #-}
-module Test.KitchenSinkSpec
- ( spec
- ) where
-
-import qualified Data.Text.IO as Text.IO
-import qualified Data.Text.Lazy.IO as Text.Lazy.IO
-import qualified Data.Text.Lazy as Lazy (Text)
-import qualified Language.GraphQL.AST.Encoder as Encoder
-import qualified Language.GraphQL.AST.Parser as Parser
-import Paths_graphql (getDataFileName)
-import Test.Hspec (Spec, describe, it)
-import Test.Hspec.Megaparsec (parseSatisfies)
-import Text.Megaparsec (parse)
-import Text.RawString.QQ (r)
-
-spec :: Spec
-spec = describe "Kitchen Sink" $ do
- it "minifies the query" $ do
- dataFileName <- getDataFileName "tests/data/kitchen-sink.graphql"
- minFileName <- getDataFileName "tests/data/kitchen-sink.min.graphql"
- expected <- Text.Lazy.IO.readFile minFileName
-
- shouldNormalize Encoder.minified dataFileName expected
-
- it "pretty prints the query" $ do
- dataFileName <- getDataFileName "tests/data/kitchen-sink.graphql"
- let expected = [r|query queryName($foo: ComplexType, $site: Site = MOBILE) {
- whoever123is: node(id: [123, 456]) {
- id
- ... on User @defer {
- field2 {
- id
- alias: field1(first: 10, after: $foo) @include(if: $foo) {
- id
- ...frag
- }
- }
- }
- }
-}
-
-mutation likeStory {
- like(story: 123) @defer {
- story {
- id
- }
- }
-}
-
-fragment frag on Friend {
- foo(size: $size, bar: $b, obj: {key: "value"})
-}
-
-{
- unnamed(truthy: true, falsey: false)
- query
-}
-|]
-
- shouldNormalize Encoder.pretty dataFileName expected
-
-shouldNormalize :: Encoder.Formatter -> FilePath -> Lazy.Text -> IO ()
-shouldNormalize formatter dataFileName expected = do
- actual <- Text.IO.readFile dataFileName
- parse Parser.document dataFileName actual `parseSatisfies` condition
- where
- condition = (expected ==) . Encoder.document formatter
diff --git a/tests/data/kitchen-sink.graphql b/tests/data/kitchen-sink.graphql
deleted file mode 100644
index 89903b7..0000000
--- a/tests/data/kitchen-sink.graphql
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (c) 2015, Facebook, Inc.
-# All rights reserved.
-#
-# This source code is licensed under the BSD-style license found in the
-# LICENSE file in the root directory of this source tree. An additional grant
-# of patent rights can be found in the PATENTS file in the same directory.
-
-query queryName($foo: ComplexType, $site: Site = MOBILE) {
- whoever123is: node(id: [123, 456]) {
- id, # Inline test comment
- ... on User @defer {
- field2 {
- id,
- alias: field1(first: 10, after: $foo) @include(if: $foo) {
- id,
- ...frag
- }
- }
- }
- }
-}
-
-mutation likeStory {
- like(story: 123) @defer {
- story {
- id
- }
- }
-}
-
-fragment frag on Friend {
- foo(size: $size, bar: $b, obj: {key: "value"})
-}
-
-{
- unnamed(truthy: true, falsey: false),
- query
-}
diff --git a/tests/data/kitchen-sink.min.graphql b/tests/data/kitchen-sink.min.graphql
deleted file mode 100644
index 24f5c26..0000000
--- a/tests/data/kitchen-sink.min.graphql
+++ /dev/null
@@ -1 +0,0 @@
-query queryName($foo:ComplexType,$site:Site=MOBILE){whoever123is:node(id:[123,456]){id,... on User@defer{field2{id,alias:field1(first:10,after:$foo)@include(if:$foo){id,...frag}}}}}mutation likeStory{like(story:123)@defer{story{id}}}fragment frag on Friend{foo(size:$size,bar:$b,obj:{key:"value"})}{unnamed(truthy:true,falsey:false),query}