A test scope used in tests that allows controlling and testing transforms.

Summary

Public functions

TransformScope

Creates a TransformScope for use in this TransformTestScope.

Cmn
Unit

Advance the state which executes any pending transforms, if any.

Cmn
Unit

Advance the clock by duration

Cmn
Unit

Advance the clock until no work is scheduled

Cmn
suspend Unit

Starts this TransformScope in the test environment and begins the process of updating its state transformations.

Cmn

Public properties

CoroutineScope

Scope for work that must not block test completion, such as running transforms.

Cmn
TestCoroutineScheduler

A scheduler used by CoroutineScope

Cmn
TestDispatcher

The dispatcher to run transforms on, so that advance executes their transforms.

Cmn

Public functions

TransformScope

fun TransformScope(): TransformScope

Creates a TransformScope for use in this TransformTestScope.

advance

fun advance(): Unit

Advance the state which executes any pending transforms, if any.

advanceTimeBy

fun advanceTimeBy(duration: Duration): Unit

Advance the clock by duration

advanceUntilIdle

fun advanceUntilIdle(): Unit

Advance the clock until no work is scheduled

TransformScope.run

suspend fun TransformScope.run(): Unit

Starts this TransformScope in the test environment and begins the process of updating its state transformations.

Public properties

backgroundScope

val backgroundScope: CoroutineScope

Scope for work that must not block test completion, such as running transforms. Cancelled when the test completes, which disposes the transforms running in it.

testCoroutineScheduler

val testCoroutineScheduler: TestCoroutineScheduler

A scheduler used by CoroutineScope

testDispatcher

val testDispatcher: TestDispatcher

The dispatcher to run transforms on, so that advance executes their transforms.