Last active
July 3, 2023 20:46
-
-
Save Foxpace/a8da0dfe814d40b90d2b89fdc196edb7 to your computer and use it in GitHub Desktop.
Fix for the missing main thread in unit test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Before | |
fun setUp() { | |
// setting up test dispatcher as main dispatcher for coroutines | |
Dispatchers.setMain(StandardTestDispatcher()) | |
} | |
@After | |
fun tearDown() { | |
// removing the test dispatcher | |
Dispatchers.resetMain() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment