mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-10-05 06:18:04 +03:00
server: add test case for null value forwarding in Remote Schemas
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9800 Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com> GitOrigin-RevId: 2be2b2f794aa3236a1204ac3ef24283dabbcf429
This commit is contained in:
parent
2bc882ebc9
commit
0151e25e8b
@ -183,6 +183,7 @@ spec = do
|
||||
testNoVarExpansionIfNoPreset
|
||||
testNoVarExpansionIfNoPresetUnlessTopLevelOptionalField
|
||||
testNoVarExpansionIfNoPresetUnlessTopLevelOptionalFieldSendNullField
|
||||
testNoVarExpansionIfNoPresetUnlessTopLevelOptionalFieldSendNullFieldForObjectField
|
||||
testPartialVarExpansionIfPreset
|
||||
testVariableSubstitutionCollision
|
||||
|
||||
@ -294,7 +295,7 @@ query($a: A) {
|
||||
)
|
||||
|
||||
testNoVarExpansionIfNoPresetUnlessTopLevelOptionalFieldSendNullField :: Spec
|
||||
testNoVarExpansionIfNoPresetUnlessTopLevelOptionalFieldSendNullField = it "send null value in the input variable for nullable field" $ do
|
||||
testNoVarExpansionIfNoPresetUnlessTopLevelOptionalFieldSendNullField = it "send null value in the input variable for nullable scalar field" $ do
|
||||
field <-
|
||||
run
|
||||
-- schema
|
||||
@ -328,6 +329,53 @@ query ($a: Int) {
|
||||
(J.Null)
|
||||
)
|
||||
|
||||
testNoVarExpansionIfNoPresetUnlessTopLevelOptionalFieldSendNullFieldForObjectField :: Spec
|
||||
testNoVarExpansionIfNoPresetUnlessTopLevelOptionalFieldSendNullFieldForObjectField = it "send null value in the input variable for nullable object field " $ do
|
||||
field <-
|
||||
run
|
||||
-- schema
|
||||
[raw|
|
||||
scalar Int
|
||||
|
||||
input A {
|
||||
b: B
|
||||
}
|
||||
|
||||
input B {
|
||||
c: C
|
||||
}
|
||||
|
||||
input C {
|
||||
i: Int
|
||||
}
|
||||
|
||||
type Query {
|
||||
test(a: A): Int
|
||||
}
|
||||
|]
|
||||
-- query
|
||||
[raw|
|
||||
query($a: A) {
|
||||
test(a: $a)
|
||||
}
|
||||
|]
|
||||
-- variables
|
||||
[raw|
|
||||
{
|
||||
"a": null
|
||||
}
|
||||
|]
|
||||
let arg = head $ HashMap.toList $ _fArguments field
|
||||
arg
|
||||
`shouldBe` ( _a,
|
||||
-- fieldOptional has peeled the variable; all we see is a JSON blob, and in doubt
|
||||
-- we repackage it as a newly minted JSON variable
|
||||
G.VVariable
|
||||
$ RemoteJSONValue
|
||||
(G.TypeNamed (G.Nullability True) _A)
|
||||
(J.Null)
|
||||
)
|
||||
|
||||
testPartialVarExpansionIfPreset :: Spec
|
||||
testPartialVarExpansionIfPreset = it "presets cause partial var expansion" $ do
|
||||
field <-
|
||||
|
Loading…
Reference in New Issue
Block a user