Skip to content

Commit

Permalink
unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
danadajian committed Aug 21, 2024
1 parent e92c452 commit 12971e2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/unit/should_consolidate_input_and_output_types/expected.kt
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,23 @@ enum class Enum2 {
fun findByName(name: String, ignoreCase: Boolean = false): Enum2? = values().find { it.name.equals(name, ignoreCase = ignoreCase) }
}
}

@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.OBJECT])
data class MyNullabilityType(
val field1: MyNestedNullabilityType
)

@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.INPUT_OBJECT])
data class MyNullabilityTypeInput(
val field1: MyNestedNullabilityTypeInput
)

@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.OBJECT])
data class MyNestedNullabilityType(
val field2: String
)

@GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations.Locations.INPUT_OBJECT])
data class MyNestedNullabilityTypeInput(
val field2: String
)
20 changes: 20 additions & 0 deletions test/unit/should_consolidate_input_and_output_types/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ input MySuperSetTypeInput {
field3: Int
}

# case where fields are different enum types

type MyTypeWithEnums {
field1: [Enum1!]
field2: [Enum2!]
Expand All @@ -149,3 +151,21 @@ enum Enum1 {
enum Enum2 {
THE_OTHER
}

# case where fields have different nullability

type MyNullabilityType {
field1: MyNestedNullabilityType!
}

input MyNullabilityTypeInput {
field1: MyNestedNullabilityTypeInput
}

type MyNestedNullabilityType {
field2: String!
}

input MyNestedNullabilityTypeInput {
field2: String!
}

0 comments on commit 12971e2

Please sign in to comment.