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

Sergio Crespo Toubes

09/10/2019, 2:48 PM
Hello, can someone help me? How can i test method like this?
Copy code
fun loadData() = MainScope().launch {

}
d

dector

09/10/2019, 2:51 PM
With
kotlinx-coroutines-test
library (https://github.com/Kotlin/kotlinx.coroutines/tree/master/kotlinx-coroutines-test) there a few ways to do it: using
Dispatchers.setMain()
or launching coroutine context to
launch()
function.
s

Sergio Crespo Toubes

09/10/2019, 2:58 PM
Thank you !!