Skip to content

Commit 31dec6e

Browse files
committed
Test that exhibits issue with multiple graphql Types aliased to a single kotlin type
1 parent d3a9d7e commit 31dec6e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/test/kotlin/com/github/pgutkowski/kgraphql/integration/BaseSchemaTest.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,18 @@ abstract class BaseSchemaTest {
232232
}}
233233
}
234234
}
235+
236+
inputType<Actor>() {
237+
name = "ActorInput"
238+
}
239+
240+
mutation("createActorWithAliasedInputType") {
241+
description = "create new actor from full fledged ActorInput as input type"
242+
resolver { newActor: Actor ->
243+
createdActors.add(newActor)
244+
newActor
245+
}
246+
}
235247
}
236248

237249
@After

src/test/kotlin/com/github/pgutkowski/kgraphql/integration/MutationTest.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,12 @@ class MutationTest : BaseSchemaTest() {
6969
assertNoErrors(map)
7070
assertThat(map.extract<Map<String, Any>>("data/createActor"), equalTo(mapOf<String, Any>("howOld" to testActor.age)))
7171
}
72+
73+
@Test
74+
fun `simple mutation with aliased input type`(){
75+
val map = execute("mutation(\$newActor: ActorInput!) { createActorWithAliasedInputType(newActor: \$newActor) {name}}",
76+
variables = "{\"newActor\": {\"name\": \"${testActor.name}\", \"age\": ${testActor.age}}}")
77+
assertNoErrors(map)
78+
assertThat(map.extract<Map<String, Any>>("data/createActorWithAliasedInputType"), equalTo(mapOf<String, Any>("name" to testActor.name)))
79+
}
7280
}

0 commit comments

Comments
 (0)