2020-08-22 06:39:52 +02:00
|
|
|
{- 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/. -}
|
|
|
|
|
2019-07-23 06:04:33 +02:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Language.GraphQL.ErrorSpec
|
|
|
|
( spec
|
|
|
|
) where
|
|
|
|
|
|
|
|
import qualified Data.Aeson as Aeson
|
2020-07-05 14:36:00 +02:00
|
|
|
import qualified Data.Sequence as Seq
|
2019-07-23 06:04:33 +02:00
|
|
|
import Language.GraphQL.Error
|
|
|
|
import Test.Hspec ( Spec
|
|
|
|
, describe
|
|
|
|
, it
|
|
|
|
, shouldBe
|
|
|
|
)
|
|
|
|
|
|
|
|
spec :: Spec
|
|
|
|
spec = describe "singleError" $
|
|
|
|
it "constructs an error with the given message" $
|
2020-07-08 08:16:14 +02:00
|
|
|
let errors'' = Seq.singleton $ Error "Message." []
|
2020-07-05 14:36:00 +02:00
|
|
|
expected = Response Aeson.Null errors''
|
2019-07-23 06:04:33 +02:00
|
|
|
in singleError "Message." `shouldBe` expected
|