# orbit-mvi

Mikolaj Leszczynski

11/06/2023, 3:03 PM
I think this was introduced in a recent version of
. I am pretty sure we didn't change anything in how the old test framework works in
- You can test this theory by using version
which has none of the recent test framework changes but has
kotlin 1.7.10
As for Orbit
- we've tested this version in a large project with almost 3000 unit tests, mostly using the old testing framework - and we've only seen a few broken tests. Tests in this project were all based on the Android ViewModel - so we are not providing any custom
to the container host. My guess would be that most of the problems you're experiencing are a combination of changes in
and the fact you're injecting the scope in tests. Where this is important for Orbit - if you use the test scope to create the container, you are responsible for making sure there are no running intents at the end of the test. Usually if you still have running intents at the end of the test it means you are collecting some long-running, infinite flow. We have a section in the docs on how to effectively test this. But, TL;DR you have a few options: 1. Mock the flows out making them finite (preferable) 2. Cancel the intents collecting flows at the end of the test (only possible with the new testing framework thanks to intent jobs) 3. Cancel the container
Overall I do recommend using the new testing framework as I think it fits much better into the coroutine testing workflow - but at the same time I know that it's not easy to refactor many old tests. Please let me know if any of this helps and do come back to me if you keep having problems!! I'll try to help.
👍 2