Peter Farlow
TestScope.backgroundScope
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() } } }
A modern programming language that makes developers happier.