diff --git a/src/commonTest/kotlin/co/pokeapi/pokekotlin/test/BulkTest.kt b/src/commonTest/kotlin/co/pokeapi/pokekotlin/test/BulkTest.kt index e2373f6b..b118537a 100644 --- a/src/commonTest/kotlin/co/pokeapi/pokekotlin/test/BulkTest.kt +++ b/src/commonTest/kotlin/co/pokeapi/pokekotlin/test/BulkTest.kt @@ -2,11 +2,15 @@ package co.pokeapi.pokekotlin.test import co.pokeapi.pokekotlin.model.ResourceSummary import co.pokeapi.pokekotlin.model.ResourceSummaryList +import kotlin.math.min import kotlin.test.Test import kotlin.test.fail import kotlinx.coroutines.test.runTest -@IgnoreOnJvm // Should work on JVM but it's OOMing. +private const val FIRST_N = 100 +private const val LAST_N = 100 +private const val MIDDLE_N = 100 + class BulkTest { private suspend fun testCase(cat: String, id: Int, getObject: suspend (Int) -> Any) { @@ -24,7 +28,21 @@ class BulkTest { getObject: suspend (Int) -> O, ) { val list = getList(0, getList(0, 0).count).results - list.forEach { testCase(list[0].category, it.id, getObject) } + val category = list[0].category + + list.take(FIRST_N).forEach { testCase(category, it.id, getObject) } + + if (list.size > FIRST_N + LAST_N) { + val n = min(MIDDLE_N, list.size - FIRST_N - LAST_N) + list.drop(FIRST_N).dropLast(LAST_N).shuffled().take(n).forEach { + testCase(category, it.id, getObject) + } + } + + if (list.size > FIRST_N) { + val n = min(LAST_N, list.size - FIRST_N) + list.takeLast(n).forEach { testCase(category, it.id, getObject) } + } } @Test diff --git a/src/commonTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.kt b/src/commonTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.kt deleted file mode 100644 index eb6199bc..00000000 --- a/src/commonTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.kt +++ /dev/null @@ -1,6 +0,0 @@ -package co.pokeapi.pokekotlin.test - -/** Stub annotation to act as a typealias destination for non-applied Ignores. */ -@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) annotation class NoOpIgnore() - -@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) expect annotation class IgnoreOnJvm() diff --git a/src/jsTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.js.kt b/src/jsTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.js.kt deleted file mode 100644 index a55d7b6b..00000000 --- a/src/jsTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.js.kt +++ /dev/null @@ -1,3 +0,0 @@ -package co.pokeapi.pokekotlin.test - -actual typealias IgnoreOnJvm = NoOpIgnore diff --git a/src/jvmTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.jvm.kt b/src/jvmTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.jvm.kt deleted file mode 100644 index 84320018..00000000 --- a/src/jvmTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.jvm.kt +++ /dev/null @@ -1,3 +0,0 @@ -package co.pokeapi.pokekotlin.test - -actual typealias IgnoreOnJvm = org.junit.Ignore diff --git a/src/nativeTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.native.kt b/src/nativeTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.native.kt deleted file mode 100644 index a55d7b6b..00000000 --- a/src/nativeTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.native.kt +++ /dev/null @@ -1,3 +0,0 @@ -package co.pokeapi.pokekotlin.test - -actual typealias IgnoreOnJvm = NoOpIgnore diff --git a/src/wasmJsTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.wasmJs.kt b/src/wasmJsTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.wasmJs.kt deleted file mode 100644 index a55d7b6b..00000000 --- a/src/wasmJsTest/kotlin/co/pokeapi/pokekotlin/test/Ignore.wasmJs.kt +++ /dev/null @@ -1,3 +0,0 @@ -package co.pokeapi.pokekotlin.test - -actual typealias IgnoreOnJvm = NoOpIgnore