runTestUnconfined

fun runTestUnconfined(testBody: suspend TestScope.() -> Unit)

A helper function to run a test using the UnconfinedTestDispatcher.

This function simplifies running coroutine tests by providing an UnconfinedTestDispatcher as the context, ensuring that coroutines are executed immediately without any delay.

Example usage:

@Test
fun exampleTest() = runTestUnconfined {
// Given a scenario that requires coroutines

// When executing coroutine-based code

// Then verify the expected outcome
}

Parameters

testBody

The suspending function containing the test code to be executed.