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
actual open class BaseTest
expect 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
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
actual annotation class IgnoreJs

Marks a test or test class to be skipped on the JS target.

actual annotation class IgnoreJs

Marks a test or test class to be skipped on the JS target.

expect annotation class IgnoreJs

Marks a test or test class to be skipped on the JS target.

actual typealias IgnoreJs = Ignore
typealias IgnoreJs = Ignore

Marks a test or test class to be skipped on the JS target.

actual annotation class IgnoreJs

Marks a test or test class to be skipped on the JS target.

actual annotation class IgnoreJs

Marks a test or test class to be skipped on the JS target.

Link copied to clipboard
actual annotation class IgnoreWasm

Marks a test or test class to be skipped on the Kotlin/Wasm target.

actual annotation class IgnoreWasm

Marks a test or test class to be skipped on the Kotlin/Wasm target.

expect annotation class IgnoreWasm

Marks a test or test class to be skipped on the Kotlin/Wasm target.

actual annotation class IgnoreWasm

Marks a test or test class to be skipped on the Kotlin/Wasm target.

actual annotation class IgnoreWasm

Marks a test or test class to be skipped on the Kotlin/Wasm target.

actual typealias IgnoreWasm = Ignore
typealias IgnoreWasm = Ignore

Marks a test or test class to be skipped on the Kotlin/Wasm target.

Link copied to clipboard
actual annotation class IgnoreWeb

Marks a test or test class to be skipped on both web targets (Kotlin/JS and Kotlin/Wasm) — a shortcut for applying both IgnoreJs and IgnoreWasm.

actual annotation class IgnoreWeb

Marks a test or test class to be skipped on both web targets (Kotlin/JS and Kotlin/Wasm) — a shortcut for applying both IgnoreJs and IgnoreWasm.

expect annotation class IgnoreWeb

Marks a test or test class to be skipped on both web targets (Kotlin/JS and Kotlin/Wasm) — a shortcut for applying both IgnoreJs and IgnoreWasm.

actual annotation class IgnoreWeb

Marks a test or test class to be skipped on both web targets (Kotlin/JS and Kotlin/Wasm) — a shortcut for applying both IgnoreJs and IgnoreWasm.

actual typealias IgnoreWeb = Ignore
typealias IgnoreWeb = Ignore

Marks a test or test class to be skipped on both web targets (Kotlin/JS and Kotlin/Wasm) — a shortcut for applying both IgnoreJs and IgnoreWasm.

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
fun testBlockingAndCancelScope(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> Unit): TestResult

Runs block as a test and then cancels any coroutines it left running in the runner's scope, so a test that deliberately launches a never-completing child (e.g. an infinite collector) does not hang.

Link copied to clipboard
actual fun testRunBlocking(context: CoroutineContext, block: suspend CoroutineScope.() -> Unit): TestResult

Runs block as the body of a test and returns a TestResult that the Kotlin test framework awaits: it blocks until completion on JVM/Native, and returns the backing Promise on js/wasmJs (which is single-threaded and cannot block). Returning the result from a @Test function is what lets suspending tests actually run on the JS family, rather than firing-and-forgetting as a bare com.splendo.kaluga.base.runBlocking would.

actual fun testRunBlocking(context: CoroutineContext, block: suspend CoroutineScope.() -> Unit): TestResult

Runs block as the body of a test and returns a TestResult that the Kotlin test framework awaits: it blocks until completion on JVM/Native, and returns the backing Promise on js/wasmJs (which is single-threaded and cannot block). Returning the result from a @Test function is what lets suspending tests actually run on the JS family, rather than firing-and-forgetting as a bare com.splendo.kaluga.base.runBlocking would.

expect fun testRunBlocking(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> Unit): TestResult

Runs block as the body of a test and returns a TestResult that the Kotlin test framework awaits: it blocks until completion on JVM/Native, and returns the backing Promise on js/wasmJs (which is single-threaded and cannot block). Returning the result from a @Test function is what lets suspending tests actually run on the JS family, rather than firing-and-forgetting as a bare com.splendo.kaluga.base.runBlocking would.

actual fun testRunBlocking(context: CoroutineContext, block: suspend CoroutineScope.() -> Unit): TestResult

Runs block as the body of a test and returns a TestResult that the Kotlin test framework awaits: it blocks until completion on JVM/Native, and returns the backing Promise on js/wasmJs (which is single-threaded and cannot block). Returning the result from a @Test function is what lets suspending tests actually run on the JS family, rather than firing-and-forgetting as a bare com.splendo.kaluga.base.runBlocking would.

actual fun testRunBlocking(context: CoroutineContext, block: suspend CoroutineScope.() -> Unit): TestResult

Runs block as the body of a test and returns a TestResult that the Kotlin test framework awaits: it blocks until completion on JVM/Native, and returns the backing Promise on js/wasmJs (which is single-threaded and cannot block). Returning the result from a @Test function is what lets suspending tests actually run on the JS family, rather than firing-and-forgetting as a bare com.splendo.kaluga.base.runBlocking would.

actual fun testRunBlocking(context: CoroutineContext, block: suspend CoroutineScope.() -> Unit): TestResult

Runs block as the body of a test and returns a TestResult that the Kotlin test framework awaits: it blocks until completion on JVM/Native, and returns the backing Promise on js/wasmJs (which is single-threaded and cannot block). Returning the result from a @Test function is what lets suspending tests actually run on the JS family, rather than firing-and-forgetting as a bare com.splendo.kaluga.base.runBlocking would.

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.