mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-25 08:24:00 +03:00
d905911eab
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4524 Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com> Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com> GitOrigin-RevId: 1cae7a1596825925da9e82c2675507482f41c3fb
143 lines
2.5 KiB
Haskell
143 lines
2.5 KiB
Haskell
{-# LANGUAGE QuasiQuotes #-}
|
|
|
|
-- | Common functions for test
|
|
module Test.DisableRootFields.Common
|
|
( listQuery,
|
|
listRFEnabledExpectedResponse,
|
|
listRFDisabledExpectedResponse,
|
|
pkQuery,
|
|
pkRFEnabledExpectedResponse,
|
|
pkRFDisabledExpectedResponse,
|
|
aggregateQuery,
|
|
aggRFEnabledExpectedResponse,
|
|
aggRFDisabledExpectedResponse,
|
|
queryTypesIntrospection,
|
|
subscriptionTypesIntrospection,
|
|
)
|
|
where
|
|
|
|
import Data.Aeson (Value)
|
|
import Harness.Quoter.Graphql (graphql)
|
|
import Harness.Quoter.Yaml (yaml)
|
|
|
|
listQuery :: Value
|
|
listQuery =
|
|
[graphql|
|
|
query {
|
|
hasura_author {
|
|
id
|
|
name
|
|
}
|
|
}
|
|
|]
|
|
|
|
listRFEnabledExpectedResponse :: Value
|
|
listRFEnabledExpectedResponse =
|
|
[yaml|
|
|
data:
|
|
hasura_author:
|
|
- id: 1
|
|
name: Author 1
|
|
|]
|
|
|
|
listRFDisabledExpectedResponse :: Value
|
|
listRFDisabledExpectedResponse =
|
|
[yaml|
|
|
errors:
|
|
- extensions:
|
|
path: $.selectionSet.hasura_author
|
|
code: validation-failed
|
|
message: 'field "hasura_author" not found in type: ''query_root'''
|
|
|]
|
|
|
|
pkQuery :: Value
|
|
pkQuery =
|
|
[graphql|
|
|
query {
|
|
hasura_author_by_pk(id: 1) {
|
|
id
|
|
name
|
|
}
|
|
}
|
|
|]
|
|
|
|
pkRFEnabledExpectedResponse :: Value
|
|
pkRFEnabledExpectedResponse =
|
|
[yaml|
|
|
data:
|
|
hasura_author_by_pk:
|
|
id: 1
|
|
name: Author 1
|
|
|]
|
|
|
|
pkRFDisabledExpectedResponse :: Value
|
|
pkRFDisabledExpectedResponse =
|
|
[yaml|
|
|
errors:
|
|
- extensions:
|
|
path: $.selectionSet.hasura_author_by_pk
|
|
code: validation-failed
|
|
message: 'field "hasura_author_by_pk" not found in type: ''query_root'''
|
|
|]
|
|
|
|
aggregateQuery :: Value
|
|
aggregateQuery =
|
|
[graphql|
|
|
query {
|
|
hasura_author_aggregate {
|
|
aggregate {
|
|
count
|
|
}
|
|
}
|
|
}
|
|
|]
|
|
|
|
aggRFEnabledExpectedResponse :: Value
|
|
aggRFEnabledExpectedResponse =
|
|
[yaml|
|
|
data:
|
|
hasura_author_aggregate:
|
|
aggregate:
|
|
count: 1
|
|
|]
|
|
|
|
aggRFDisabledExpectedResponse :: Value
|
|
aggRFDisabledExpectedResponse =
|
|
[yaml|
|
|
errors:
|
|
- extensions:
|
|
path: $.selectionSet.hasura_author_aggregate
|
|
code: validation-failed
|
|
message: 'field "hasura_author_aggregate" not found in type: ''query_root'''
|
|
|]
|
|
|
|
queryTypesIntrospection :: Value
|
|
queryTypesIntrospection =
|
|
[graphql|
|
|
query {
|
|
__schema {
|
|
queryType {
|
|
fields{
|
|
name
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|]
|
|
|
|
subscriptionTypesIntrospection :: Value
|
|
subscriptionTypesIntrospection =
|
|
[graphql|
|
|
query {
|
|
__schema {
|
|
subscriptionType {
|
|
fields{
|
|
name
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|]
|