expectSideEffect

abstract fun expectSideEffect(description: String, exactMatch: Boolean = true, matcher: (key: String) -> Boolean): RenderTester<PropsT, StateT, OutputT, RenderingT>(source)

Specifies that this render pass is expected to run a side effect with a key that satisfies matcher. This expectation is strict, and will fail if multiple side effects match.

Parameters

description

String that will be used to describe this expectation in error messages. The description is required since no human-readable description can be derived from the predicate alone.

exactMatch

If true, then the test will fail if any other matching expectations are also exact matches, and the expectation will only be allowed to match a single side effect. If false, the match will only be used if no other expectations return exclusive matches (in which case the first match will be used), and the expectation may match multiple side effects.

matcher

A function that is passed the key value from runningSideEffect and return true if this key is expected.