testEffect
fun testEffect(effect: Transmission.Effect, assertions: suspend TransmissionTest.TestResult.() -> Unit)
Executes a test with the given effect transmission and runs the provided assertions.
This method processes the effect through the configured router and captures all resulting data and effect streams for assertion. The assertions are executed with access to the captured streams through the TestResult receiver.
Parameters
effect
The effect transmission to test
assertions
Lambda with TestResult receiver for making assertions
Example usage:
transformer.test()
.testEffect(CacheEffect.Invalidate("user_data")) {
// Assert that cache invalidation triggered cleanup
val clearEffect = lastEffect<CacheEffect.Cleared>()
assertNotNull(clearEffect)
// Assert no data was emitted
assertTrue(dataStream.isEmpty())
}
Content copied to clipboard