https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
s

spand

10/15/2018, 9:01 AM
There is no
runBlocking
for js hence not in common either
🏁 1
l

Leonid Popescu

10/15/2018, 9:02 AM
so is there a work around for this in order to test the suspending functions in the common part ?
you can define your own method to run test as an expect method in common
l

Leonid Popescu

10/15/2018, 9:08 AM
thx Daniel, this is what I just did and it seems to work
in common part
Copy code
expect fun <T> runBlockingCommon(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> T): T
and in jvm
Copy code
actual fun <T> runBlockingCommon(context: CoroutineContext, block: suspend CoroutineScope.() -> T): T = runBlocking(context, block)
but how it’s done in the link you posted is nicer