testSignal
fun testSignal(signal: Transmission.Signal, assertions: suspend TransmissionTest.TestResult.() -> Unit)
Executes a test with the given signal transmission and runs the provided assertions.
This method processes the signal 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
signal
The signal transmission to test
assertions
Lambda with TestResult receiver for making assertions
Example usage:
transformer.test()
.testSignal(UserSignal.Login("username", "password")) {
// Assert successful login data
val loginData = lastData<UserData.LoggedIn>()
assertNotNull(loginData)
assertEquals("username", loginData.user.username)
// Assert login effect was published
val loginEffect = lastEffect<AuthEffect.LoginSuccessful>()
assertNotNull(loginEffect)
}
Content copied to clipboard