https://kotlinlang.org logo
#ktor
Title
# ktor
b

benkuly

11/07/2023, 5:16 PM
Since setting
dispatcher
is deprecated in `MockEngine`: Is there an alternative for the following test use case:
Copy code
val testScope = CoroutineScope(coroutineContext + SupervisorJob()) // coroutineContext is from TestDispatcher
testScope.launch {
    println(1)
    delay(10000)
    println(2)
    HttpClient(mockEngine).post("/bla")
    println(3)
}
testCoroutineScheduler.advanceUntilIdle()
println("---------------")
This will print:
Copy code
1
2
---------------
But I expect
advanceUntilIdle
to wait for the http request too.
e

e5l

11/08/2023, 8:01 AM
Hey @benkuly, we’re going to revert deprecation and allow changing dispatcher in the future release