From 07bfff7b8481a55408f14cdbd1fbc8e33733d725 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 19 Jul 2024 14:33:36 +0200 Subject: [PATCH] Add a test for https://github.com/graphql/graphql-spec/issues/1106 --- libraries/apollo-ast/build.gradle.kts | 1 + .../apollo/graphql/ast/test/CommonParserTest.kt | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/libraries/apollo-ast/build.gradle.kts b/libraries/apollo-ast/build.gradle.kts index c72ed677650..af0f2402962 100644 --- a/libraries/apollo-ast/build.gradle.kts +++ b/libraries/apollo-ast/build.gradle.kts @@ -32,6 +32,7 @@ kotlin { getByName("jvmTest") { dependencies { implementation(libs.google.testparameterinjector) + implementation(libs.kotlin.test) } } } diff --git a/libraries/apollo-ast/src/commonTest/kotlin/com/apollographql/apollo/graphql/ast/test/CommonParserTest.kt b/libraries/apollo-ast/src/commonTest/kotlin/com/apollographql/apollo/graphql/ast/test/CommonParserTest.kt index 44d5888c2c9..7496bece8c0 100644 --- a/libraries/apollo-ast/src/commonTest/kotlin/com/apollographql/apollo/graphql/ast/test/CommonParserTest.kt +++ b/libraries/apollo-ast/src/commonTest/kotlin/com/apollographql/apollo/graphql/ast/test/CommonParserTest.kt @@ -9,6 +9,7 @@ import com.apollographql.apollo.ast.parseAsGQLDocument import com.apollographql.apollo.ast.parseAsGQLValue import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertFails import kotlin.test.fail class CommonParserTest { @@ -111,4 +112,19 @@ query Test { assertEquals(3, column) } } + + /** + * https://github.com/graphql/graphql-spec/issues/1106 + */ + @Test + fun extendTypeMustAddDirectiveFieldOrInterface() { + assertFails { + """ + extend type Query + """.trimIndent() + .parseAsGQLDocument() + .getOrThrow() + + } + } }