Skip to content

Commit 23f3f63

Browse files
committed
Add another hashing test case.
1 parent e351b0d commit 23f3f63

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/DocumentTests.elm

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,35 @@ all =
406406
me1529416052: me(id: 456) {
407407
firstName
408408
}
409+
}"""
410+
, test "duplicate fields are merged and still only hashed as needed" <|
411+
\() ->
412+
document
413+
[ leaf "avatar" []
414+
, leaf "avatar" []
415+
, Composite "me"
416+
[ Graphql.Internal.Builder.Argument.Argument "id" (Graphql.Internal.Encode.int 123)
417+
]
418+
[ leaf "firstName" []
419+
, leaf "firstName" []
420+
, leaf "avatar" [ intArg { key = "size", value = 1 } ]
421+
, leaf "avatar" [ intArg { key = "size", value = 2 } ]
422+
]
423+
, Composite "me"
424+
[ Graphql.Internal.Builder.Argument.Argument "id" (Graphql.Internal.Encode.int 123)
425+
]
426+
[ leaf "firstName" []
427+
, leaf "firstName" []
428+
]
429+
]
430+
|> Graphql.Document.serializeQuery
431+
|> Expect.equal """query {
432+
avatar
433+
me(id: 123) {
434+
firstName
435+
avatar2648687506: avatar(size: 1)
436+
avatar76140203: avatar(size: 2)
437+
}
409438
}"""
410439
]
411440
]

0 commit comments

Comments
 (0)