From 415f10026009302ed22383db231d249858724f34 Mon Sep 17 00:00:00 2001 From: Ivar Ness Date: Fri, 4 Oct 2024 14:46:39 +0200 Subject: [PATCH] Added test for fragment on root query --- .../scala/caliban/execution/FragmentSpec.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/src/test/scala/caliban/execution/FragmentSpec.scala b/core/src/test/scala/caliban/execution/FragmentSpec.scala index 5de17b1406..cf7a9d72d2 100644 --- a/core/src/test/scala/caliban/execution/FragmentSpec.scala +++ b/core/src/test/scala/caliban/execution/FragmentSpec.scala @@ -32,6 +32,24 @@ object FragmentSpec extends ZIOSpecDefault { res <- int.execute(query) } yield assertTrue(res.data.toString == """{"amos":{"name":"Amos Burton"}}""") }, + test("fragment on root query") { + val interpreter = graphQL(resolver).interpreter + val query = gqldoc(""" + { + ...amos + } + + fragment amos on Query { + amos: character(name: "Amos Burton") { + name + } + } + """) + for { + int <- interpreter + res <- int.execute(query) + } yield assertTrue(res.data.toString == """{"amos":{"name":"Amos Burton"}}""") + }, test("fragment on union") { val query = gqldoc(""" {