I’ve just been informed for cases like this, you’r...
# test
p
I’ve just been informed for cases like this, you’re supposed to use
TestScope.backgroundScope
. Perhaps this example is more correct:
Copy code
class ExampleClassTest {
    private val mockApi = mockk<LoginApi> { coEvery { performLogin() } returns "hello" }
    private val testCoroutineScheduler = UnconfinedTestDispatcher()
    private val testScope = TestScope(testCoroutineScheduler)

    @Test
    fun `this test passes`() = testScope.runTest {
        val exampleClass = ExampleClass(mockApi, testScope.backgroundScope)
        expect("hello") {
            exampleClass.performLogin()
        }
    }
}