summaryrefslogtreecommitdiff
path: root/test/Rendering/TestSchemaRendering.hs
blob: cb561348f999fcdc19d9e0d52ee111c6439dce04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE NamedFieldPuns    #-}
{-# LANGUAGE OverloadedStrings #-}

module Rendering.TestSchemaRendering
  ( testSchemaRendering
  ) where

import           Data.Morpheus.Document     (toGraphQLDocument)
import           Rendering.Schema           (schemaProxy)
import           Test.Tasty                 (TestTree)
import           Test.Tasty.HUnit           (assertEqual, testCase)

-- TODO: better Test
testSchemaRendering :: TestTree
testSchemaRendering = testCase "Test Rendering" $ assertEqual "test schema Rendering" schema expected
  where
    schema = toGraphQLDocument schemaProxy
    expected =
      "type Query { \n  user: User!\n  testUnion: TestUnion\n}\n\nenum TestEnum { \n  EnumA\n  EnumB\n  EnumC\n}\n\nscalar TestScalar\n\ninput Coordinates { \n  latitude: TestScalar!\n  longitude: Int!\n}\n\ntype Address { \n  street: [[[[String!]!]!]]\n}\n\ntype User { \n  type: String!\n  address(coordinates: Coordinates!, type: String): Int!\n  friend(id: ID!, cityID: TestEnum): User!\n}\n\nunion TestUnion =\n    User!\n  | Address!"