jaqxues
12/24/2020, 8:15 PMScott Whitman
12/25/2020, 1:13 PM// put in commonTest
expect fun runTest(block: suspend (scope : CoroutineScope) -> Unit)
// put in jsTest
actual fun runTest(block: suspend (scope : CoroutineScope) -> Unit): dynamic = GlobalScope.promise { block(this) }
// put in jvmTest & nativeTest
actual fun runTest(block: suspend (scope : CoroutineScope) -> Unit) = runBlocking { block(this) }
Then just use runTest in place of runBlocking/runBlockingTest in your tests.
@Test
fun some_test() = runTest {
assertEquals(5, someResult())
}
I don't have a public repo available right now, but if you are using IntelliJ, the new project wizard produces the base that I have been working from that has the commonTest sourceSet.jaqxues
12/25/2020, 1:44 PMScott Whitman
12/25/2020, 2:49 PMjaqxues
12/25/2020, 3:19 PMjaqxues
01/06/2021, 9:56 AM