Hello i'm trying to use runBlocking inside my comm...
# multiplatform
m
Hello i'm trying to use runBlocking inside my commonTest module but ide can't find it is it because runBlocking isn't available in kotlinx.coroutines?
k
Yeah. You’ll need to do some form of expect actual
m
Okey thank you i will have look on this
but runTest return Unit and what i want to do is : val result = runTest { repository.login("test") } assertEquals(result, expected) and result has to be LoginRepository.Success type
k
What I sent was meant as an example. You can change your implementation to return something.
m
Yes i know but writing many runBlocking with different return type isn't great neither i guess we should take the exemple as an acceptable answer for now?
k
" writing many runBlocking with different return type” not sure what you mean here
m
in the exemple runBlocking return Unit and since i need a result so i can assert i need to write runBlocking for each type of result i need (runBlocking: LoginResponse, runBlocking: SomethingResponse etc)
k
Or use a generic?
m
Ow i'm not used to use generics but internal expect fun<T> runBlockingTest(block: suspend () -> T): T did the work thank you
k
Nice