Skip to content

Commit 5983f92

Browse files
committed
test: 💍 Rewrites TypeInferenceTest to Atrium
It was extremely hard to debug tests before: kotest didn't give us enough information about the very point where expected diverged with actual result (escpecially in deeply-nested objects). Atrium gives us pretty reified data n why test is failed as well as much shorter and easier to understand code. Also this commit moves everything test related to package, corresponding to API
1 parent d08ad70 commit 5983f92

File tree

8 files changed

+217
-292
lines changed

8 files changed

+217
-292
lines changed

examples/src/main/kotlin/org/jetbrains/spark/api/examples/Join.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ data class Right(val id: Int, val value: Int)
2828

2929

3030
fun main() {
31-
withSpark {
31+
withSpark(logLevel = SparkLogLevel.INFO) {
3232
val first = dsOf(Left(1, "a"), Left(2, "b"))
3333
val second = dsOf(Right(1, 100), Right(3, 300))
3434
first

kotlin-spark-api/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
<plugin>
122122
<groupId>org.apache.maven.plugins</groupId>
123123
<artifactId>maven-surefire-plugin</artifactId>
124-
<version>2.22.2</version>
124+
<version>3.0.0-M5</version>
125125
</plugin>
126126
<plugin>
127127
<groupId>org.jetbrains.dokka</groupId>

kotlin-spark-api/src/test/kotlin/TypeInferenceTest.kt

-285
This file was deleted.

kotlin-spark-api/src/test/kotlin/ApiTest.kt renamed to kotlin-spark-api/src/test/kotlin/org/jetbrains/spark/api/ApiTest.kt

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*-
1+
package org.jetbrains.spark.api/*-
22
* =LICENSE=
33
* Kotlin Spark API
44
* ----------
@@ -38,9 +38,15 @@ class ApiTest : ShouldSpec({
3838
should("contain all generic primitives with complex schema") {
3939
val primitives = c(1, 1.0, 1.toFloat(), 1.toByte(), LocalDate.now(), true)
4040
val primitives2 = c(2, 2.0, 2.toFloat(), 2.toByte(), LocalDate.now().plusDays(1), false)
41-
val tuples: List<Arity6<Int, Double, Float, Byte, LocalDate, Boolean>> = dsOf(primitives, primitives2).toArray<Arity6<Int, Double, Float, Byte, LocalDate, Boolean>>().toList()
41+
val tuples = dsOf(primitives, primitives2).collectAsList()
4242
expect(tuples).asExpect().contains.inAnyOrder.only.values(primitives, primitives2)
4343
}
44+
should("contain all generic primitives with complex nullable schema") {
45+
val primitives = c(1, 1.0, 1.toFloat(), 1.toByte(), LocalDate.now(), true)
46+
val nulls = c(null, null, null, null, null, null)
47+
val tuples = dsOf(primitives, nulls).collectAsList()
48+
expect(tuples).asExpect().contains.inAnyOrder.only.values(primitives, nulls)
49+
}
4450
should("handle cached operations") {
4551
val result = dsOf(1, 2, 3, 4, 5)
4652
.map { it to (it + 2) }

kotlin-spark-api/src/test/kotlin/KotlinSparkTest.kt renamed to kotlin-spark-api/src/test/kotlin/org/jetbrains/spark/api/KotlinSparkTest.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*-
1+
package org.jetbrains.spark.api/*-
22
* =LICENSE=
33
* Kotlin Spark API
44
* ----------
@@ -18,7 +18,6 @@
1818
* =LICENSEEND=
1919
*/
2020
import io.kotest.core.spec.style.AnnotationSpec
21-
import org.jetbrains.spark.api.schema
2221
import kotlin.reflect.typeOf
2322

2423
@OptIn(ExperimentalStdlibApi::class)

0 commit comments

Comments
 (0)