Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix selection merging with conflicting fragments #1213

Merged
merged 3 commits into from
Dec 17, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix Scala 3
ghostdogpr committed Dec 17, 2021
commit 969e0b8a9dd208523f49ad7338a1f3bbdc0ae2b2
61 changes: 30 additions & 31 deletions core/src/test/scala/caliban/execution/ExecutionSpec.scala
Original file line number Diff line number Diff line change
@@ -20,6 +20,35 @@ import zio.test.environment.TestEnvironment

object ExecutionSpec extends DefaultRunnableSpec {

@GQLInterface
sealed trait Base {
def id: String
def name: String
}
object Base {
@GQLName("BaseOne")
case class One(
id: String,
name: String,
inner: List[One.Inner]
) extends Base
object One {
@GQLName("BaseOneInner")
case class Inner(a: String)
}

@GQLName("BaseTwoOne")
case class Two(
id: String,
name: String,
inner: List[Two.Inner]
) extends Base
object Two {
@GQLName("BaseTwoInner")
case class Inner(b: Int)
}
}

override def spec: ZSpec[TestEnvironment, Any] =
suite("ExecutionSpec")(
testM("skip directive") {
@@ -1131,37 +1160,6 @@ object ExecutionSpec extends DefaultRunnableSpec {
},
testM("conflicting fragments selection merging") {

@GQLInterface
sealed trait Base {
def id: String
def name: String
}
object Base {
@GQLName("BaseOne")
case class One(
id: String,
name: String,
inner: List[One.Inner]
) extends Base
object One {
@GQLName("BaseOneInner")
case class Inner(a: String)
}

@GQLName("BaseTwoOne")
case class Two(
id: String,
name: String,
inner: List[Two.Inner]
) extends Base
object Two {
@GQLName("BaseTwoInner")
case class Inner(b: Int)
}
}

implicit val schema: Schema[Any, Base] = Schema.gen

val base1 = Base.One(
id = "1",
name = "base 1",
@@ -1173,6 +1171,7 @@ object ExecutionSpec extends DefaultRunnableSpec {
inner = List(Base.Two.Inner(b = 2))
)
case class Test(bases: List[Base])

val api = graphQL(RootResolver(Test(List(base1, base2))))
val query = """
query {