Stylianos Gakis
12/09/2022, 11:38 AMTestScope
provided inside the runTest{}
function to pass it to a launchIn
function to create a hot StateFlow.
Problem is, the test this way never ends since the coroutineScope always has something to do therefore runTest
times out and fails my test.
I’ve “fixed” this by adding the line this.coroutineContext.cancelChildren()
as the last line of my test after everything I’ve asserted was correct and so on. Is this considered okay or should I really be careful with something like this? Feels like I’m doing something in a way which doesn’t solve the root cause but patches it, but could be wrong.Dmitry Khalanskiy [JB]
12/09/2022, 11:39 AMStylianos Gakis
12/09/2022, 11:41 AMDmitry Khalanskiy [JB]
12/09/2022, 11:41 AMStylianos Gakis
12/09/2022, 11:42 AM