CallTracker

external class CallTracker(source)

This feature is deprecated and will be removed in a future version. Please consider using alternatives such as the mock helper function.

Since

v14.2.0, v12.19.0

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun calls(exact: Number = definedExternally): () -> Unit

The wrapper function is expected to be called exactly exact times. If the function has not been called exactly exact times when tracker.verify() is called, then tracker.verify() will throw an error.

fun <Func : Function<Any?>> calls(fn: Func = definedExternally, exact: Number = definedExternally): Func
Link copied to clipboard
Link copied to clipboard

The arrays contains information about the expected and actual number of calls of the functions that have not been called the expected number of times.

Link copied to clipboard
fun reset(fn: Function<*> = definedExternally)

Reset calls of the call tracker. If a tracked function is passed as an argument, the calls will be reset for it. If no arguments are passed, all tracked functions will be reset.

Link copied to clipboard
fun verify()

Iterates through the list of functions passed to {@link tracker.calls()} and will throw an error for functions that have not been called the expected number of times.