Package-level declarations

Types

Link copied to clipboard
typealias ActionBlock = suspend () -> Unit
Link copied to clipboard
abstract class BaseFlowTest<Configration, Context : BaseUIThreadTest.TestContext, T, F : Flow<T>>(val scope: CoroutineScope = MainScope(), val logger: Logger? = null) : BaseUIThreadTest<Configration, Context> , CoroutineScope
Link copied to clipboard
actual open class BaseTest
expect open class BaseTest
actual open class BaseTest
actual open class BaseTest
actual open class BaseTest
Link copied to clipboard

This class allows a test block to be run on the UI thread inside a custom context that is also created in the UI Thread using a configuration.

Link copied to clipboard
class DeliberateCancellationException(val result: Any?) : CancellationException
Link copied to clipboard
abstract class FlowableTest<T> : BaseTest
Link copied to clipboard
abstract class FlowTest<T, F : Flow<T>>(scope: CoroutineScope = MainScope()) : BaseFlowTest<Unit, BaseUIThreadTest.EmptyTestContext, T, F>
Link copied to clipboard
typealias FlowTestBlock<T, F> = suspend FlowTest<T, F>.(F) -> Unit
Link copied to clipboard
typealias ScopeActionBlock<Context> = suspend Context.() -> Unit
Link copied to clipboard
abstract class SimpleFlowTest<T>(scope: CoroutineScope = MainScope()) : FlowTest<T, Flow<T>>
Link copied to clipboard
typealias TestBlock<Context, T> = suspend Context.(T) -> Unit
Link copied to clipboard

This class allows a test block to be run on the UI thread inside a custom context that is also created in the UI Thread.

Properties

Link copied to clipboard

Functions

Link copied to clipboard
suspend fun <T> Flow<T>.assertEmits(expected: T, message: String = "", timeout: Duration = defaultTimeout)

Asserts that the flow emits an element matching expected within timeout.

suspend fun <T> Flow<T>.assertEmits(message: String = "", timeout: Duration = defaultTimeout, condition: suspend (T) -> Boolean)

Asserts that the flow emits an element matching condition within timeout.

Link copied to clipboard
fun <T> awaitAllBlocking(vararg deferreds: Deferred<T>): List<T>
Link copied to clipboard
suspend fun <T> Flow<T>.awaitFirst(message: String = "", timeout: Duration = defaultTimeout, condition: suspend (T) -> Boolean = { true }): T
Link copied to clipboard
suspend fun <T> Flow<T>.captureFor(duration: Duration): List<T>

Returns a list of flow items captured for duration

Link copied to clipboard
Link copied to clipboard
inline fun <T> testBlockingAndCancelScope(context: CoroutineContext = EmptyCoroutineContext, crossinline block: suspend CoroutineScope.() -> T): T
Link copied to clipboard
suspend fun yieldMultiple(times: Int = DEFAULT_MULTIPLE_TIMES_YIELDS)

Calls yield for a number of times

Link copied to clipboard
suspend fun yieldUntil(timeout: Duration = Duration.INFINITE, timesPerTurn: Int = DEFAULT_MULTIPLE_TIMES_YIELDS, delayPerTurn: Duration = 10.milliseconds, constraint: () -> Boolean)

Calls yield until a constraint is met. After yielding a number of times there is a delay to prevent maxing out the CPU.