TestProvidedCoroutineScope

@ExperimentalCoroutinesApi
interface TestProvidedCoroutineScope : TestCoroutineScope, DefaultCoroutineScope, IOCoroutineScope, MainCoroutineScope, MainImmediateCoroutineScope, UnconfinedCoroutineScope

A polymorphic testing CoroutineScope interface.

This single interface implements: TestCoroutineScopeIOCoroutineScopeMainImmediateCoroutineScope

This means that it can be injected into any class or function regardless of what type of CoroutineScope is required.

Functions

Link copied to clipboard
abstract fun advanceTimeBy(delayTimeMillis: Long): Long
Link copied to clipboard
abstract fun advanceUntilIdle(): Long
Link copied to clipboard
abstract override fun cleanupTestCoroutines()
Link copied to clipboard
abstract fun pauseDispatcher()
abstract suspend fun pauseDispatcher(block: suspend () -> Unit)
Link copied to clipboard
abstract fun resumeDispatcher()
Link copied to clipboard
abstract fun runCurrent()

Properties

Link copied to clipboard
abstract val coroutineContext: CoroutineContext
Link copied to clipboard
abstract val currentTime: Long
Link copied to clipboard
abstract val dispatcherProvider: DispatcherProvider
Link copied to clipboard
abstract val uncaughtExceptions: List<Throwable>

Extensions

Link copied to clipboard
@ExperimentalCoroutinesApi
fun TestProvidedCoroutineScope.testProvided(testBody: suspend TestProvidedCoroutineScope.() -> Unit)

Delegates to runBlockingTest, but injects a DispatcherProvider into the created TestCoroutineScope.

Sources

Link copied to clipboard