Skip to content

Commit 98fcc70

Browse files
committed
Migrated some tests to kotest.
1 parent fbcd32e commit 98fcc70

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

graphql-java-datetime/src/test/kotlin/com/tailrocks/graphql/datetime/GraphQLLocalDateTest.kt

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ class GraphQLLocalDateTest : FreeSpec({
5151
listOf(
5252
StringValue(""),
5353
StringValue("not a localdate"),
54-
Object()
5554
).forEach { literal ->
56-
shouldThrow<CoercingParseLiteralException> {
57-
GraphqlLocalDateCoercing(false, ISO_LOCAL_DATE).parseLiteral(literal)
55+
"throws exception for invalid $literal" {
56+
shouldThrow<CoercingParseLiteralException> {
57+
GraphqlLocalDateCoercing(false, ISO_LOCAL_DATE).parseLiteral(literal)
58+
}
5859
}
5960
}
6061
}
@@ -100,8 +101,10 @@ class GraphQLLocalDateTest : FreeSpec({
100101
"not a date",
101102
Object()
102103
).forEach { value ->
103-
shouldThrow<CoercingParseValueException> {
104-
GraphqlLocalDateCoercing(false, ISO_LOCAL_DATE).parseValue(value)
104+
"throws exception for invalid $value" {
105+
shouldThrow<CoercingParseValueException> {
106+
GraphqlLocalDateCoercing(false, ISO_LOCAL_DATE).parseValue(value)
107+
}
105108
}
106109
}
107110
}
@@ -128,15 +131,19 @@ class GraphQLLocalDateTest : FreeSpec({
128131
listOf(
129132
"02/09/1993" to LocalDate.of(1993, 2, 9)
130133
).forEach { (value, result) ->
131-
GraphqlLocalDateCoercing(false, formatter).parseValue(value) shouldBe result
134+
"parse $value into $result (${result::class.java}) with custom formatter" {
135+
GraphqlLocalDateCoercing(false, formatter).parseValue(value) shouldBe result
136+
}
132137
}
133138
}
134139

135140
"serialize -> success" - {
136141
listOf(
137142
LocalDate.of(2020, 7, 6) to "07/06/2020"
138143
).forEach { (value, result) ->
139-
GraphqlLocalDateCoercing(false, formatter).serialize(value) shouldBe result
144+
"serialize $value into $result (${result::class.java}) with custom formatting" {
145+
GraphqlLocalDateCoercing(false, formatter).serialize(value) shouldBe result
146+
}
140147
}
141148
}
142149
}

graphql-java-datetime/src/test/kotlin/com/tailrocks/graphql/datetime/GraphQLLocalTimeTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class GraphQLLocalTimeTest : FreeSpec({
5151
listOf(
5252
StringValue(""),
5353
StringValue("not a localtime"),
54-
Object()
5554
).forEach { literal ->
5655
"throws exception for invalid $literal" {
5756
shouldThrow<CoercingParseLiteralException> {

0 commit comments

Comments
 (0)