I am working on an App for Android and iOS and imp...
# kotlin-native
s
I am working on an App for Android and iOS and implemented some requests with ktor httpclient and coroutines. I want to write tests in the framework for suspended functions. I read about that it’s not implemented yet but there is a work around:
Copy code
expect fun <T> runTest(block: suspend () -> T)
JVM
actual fun <T> runTest(block: suspend () -> T) {
    runBlocking { block() }
}
https://blog.kotlin-academy.com/testing-common-modules-66b39d641617 https://youtrack.jetbrains.com/issue/KT-22228 How would I implement this vor the Native side? Or is there an better solution to this problem.
r
Native
actual
is identical to JVM. There's no
runBlocking
in the common stdlib because it's not present in JS, but it does exist on the other platforms.
s
Thanks I’ll try that tomorrow
I tried it and it works. Thanks