Remove raw-strings-qq
This commit is contained in:
@ -12,11 +12,11 @@ import Data.Aeson (object, (.=))
|
||||
import qualified Data.Aeson as Aeson
|
||||
import qualified Data.HashMap.Strict as HashMap
|
||||
import Language.GraphQL
|
||||
import Language.GraphQL.TH
|
||||
import Language.GraphQL.Type
|
||||
import qualified Language.GraphQL.Type.Out as Out
|
||||
import Test.Hspec (Spec, describe, it)
|
||||
import Test.Hspec.GraphQL
|
||||
import Text.RawString.QQ (r)
|
||||
|
||||
experimentalResolver :: Schema IO
|
||||
experimentalResolver = schema queryType Nothing Nothing mempty
|
||||
@ -33,7 +33,7 @@ spec :: Spec
|
||||
spec =
|
||||
describe "Directive executor" $ do
|
||||
it "should be able to @skip fields" $ do
|
||||
let sourceQuery = [r|
|
||||
let sourceQuery = [gql|
|
||||
{
|
||||
experimentalField @skip(if: true)
|
||||
}
|
||||
@ -43,7 +43,7 @@ spec =
|
||||
actual `shouldResolveTo` emptyObject
|
||||
|
||||
it "should not skip fields if @skip is false" $ do
|
||||
let sourceQuery = [r|
|
||||
let sourceQuery = [gql|
|
||||
{
|
||||
experimentalField @skip(if: false)
|
||||
}
|
||||
@ -56,7 +56,7 @@ spec =
|
||||
actual `shouldResolveTo` expected
|
||||
|
||||
it "should skip fields if @include is false" $ do
|
||||
let sourceQuery = [r|
|
||||
let sourceQuery = [gql|
|
||||
{
|
||||
experimentalField @include(if: false)
|
||||
}
|
||||
@ -66,7 +66,7 @@ spec =
|
||||
actual `shouldResolveTo` emptyObject
|
||||
|
||||
it "should be able to @skip a fragment spread" $ do
|
||||
let sourceQuery = [r|
|
||||
let sourceQuery = [gql|
|
||||
{
|
||||
...experimentalFragment @skip(if: true)
|
||||
}
|
||||
@ -80,7 +80,7 @@ spec =
|
||||
actual `shouldResolveTo` emptyObject
|
||||
|
||||
it "should be able to @skip an inline fragment" $ do
|
||||
let sourceQuery = [r|
|
||||
let sourceQuery = [gql|
|
||||
{
|
||||
... on Query @skip(if: true) {
|
||||
experimentalField
|
||||
|
@ -15,9 +15,9 @@ import Data.Text (Text)
|
||||
import Language.GraphQL
|
||||
import Language.GraphQL.Type
|
||||
import qualified Language.GraphQL.Type.Out as Out
|
||||
import Language.GraphQL.TH
|
||||
import Test.Hspec (Spec, describe, it)
|
||||
import Test.Hspec.GraphQL
|
||||
import Text.RawString.QQ (r)
|
||||
|
||||
size :: (Text, Value)
|
||||
size = ("size", String "L")
|
||||
@ -34,16 +34,18 @@ garment typeName =
|
||||
)
|
||||
|
||||
inlineQuery :: Text
|
||||
inlineQuery = [r|{
|
||||
garment {
|
||||
... on Hat {
|
||||
circumference
|
||||
}
|
||||
... on Shirt {
|
||||
size
|
||||
inlineQuery = [gql|
|
||||
{
|
||||
garment {
|
||||
... on Hat {
|
||||
circumference
|
||||
}
|
||||
... on Shirt {
|
||||
size
|
||||
}
|
||||
}
|
||||
}
|
||||
}|]
|
||||
|]
|
||||
|
||||
shirtType :: Out.ObjectType IO
|
||||
shirtType = Out.ObjectType "Shirt" Nothing [] $ HashMap.fromList
|
||||
@ -106,12 +108,14 @@ spec = do
|
||||
in actual `shouldResolveTo` expected
|
||||
|
||||
it "embeds inline fragments without type" $ do
|
||||
let sourceQuery = [r|{
|
||||
circumference
|
||||
... {
|
||||
size
|
||||
let sourceQuery = [gql|
|
||||
{
|
||||
circumference
|
||||
... {
|
||||
size
|
||||
}
|
||||
}
|
||||
}|]
|
||||
|]
|
||||
actual <- graphql (toSchema "circumference" circumference) sourceQuery
|
||||
let expected = HashMap.singleton "data"
|
||||
$ Aeson.object
|
||||
@ -121,16 +125,18 @@ spec = do
|
||||
in actual `shouldResolveTo` expected
|
||||
|
||||
it "evaluates fragments on Query" $ do
|
||||
let sourceQuery = [r|{
|
||||
... {
|
||||
size
|
||||
let sourceQuery = [gql|
|
||||
{
|
||||
... {
|
||||
size
|
||||
}
|
||||
}
|
||||
}|]
|
||||
|]
|
||||
in graphql (toSchema "size" size) `shouldResolve` sourceQuery
|
||||
|
||||
describe "Fragment spread executor" $ do
|
||||
it "evaluates fragment spreads" $ do
|
||||
let sourceQuery = [r|
|
||||
let sourceQuery = [gql|
|
||||
{
|
||||
...circumferenceFragment
|
||||
}
|
||||
@ -148,7 +154,7 @@ spec = do
|
||||
in actual `shouldResolveTo` expected
|
||||
|
||||
it "evaluates nested fragments" $ do
|
||||
let sourceQuery = [r|
|
||||
let sourceQuery = [gql|
|
||||
{
|
||||
garment {
|
||||
...circumferenceFragment
|
||||
@ -174,7 +180,7 @@ spec = do
|
||||
in actual `shouldResolveTo` expected
|
||||
|
||||
it "considers type condition" $ do
|
||||
let sourceQuery = [r|
|
||||
let sourceQuery = [gql|
|
||||
{
|
||||
garment {
|
||||
...circumferenceFragment
|
||||
|
@ -12,7 +12,7 @@ import Data.Aeson ((.=), object)
|
||||
import qualified Data.HashMap.Strict as HashMap
|
||||
import Language.GraphQL
|
||||
import Test.Hspec (Spec, describe, it)
|
||||
import Text.RawString.QQ (r)
|
||||
import Language.GraphQL.TH
|
||||
import Language.GraphQL.Type
|
||||
import qualified Language.GraphQL.Type.Out as Out
|
||||
import Test.Hspec.GraphQL
|
||||
@ -42,7 +42,7 @@ spec :: Spec
|
||||
spec =
|
||||
describe "Root operation type" $ do
|
||||
it "returns objects from the root resolvers" $ do
|
||||
let querySource = [r|
|
||||
let querySource = [gql|
|
||||
{
|
||||
garment {
|
||||
circumference
|
||||
@ -59,7 +59,7 @@ spec =
|
||||
actual `shouldResolveTo` expected
|
||||
|
||||
it "chooses Mutation" $ do
|
||||
let querySource = [r|
|
||||
let querySource = [gql|
|
||||
mutation {
|
||||
incrementCircumference
|
||||
}
|
||||
|
Reference in New Issue
Block a user