forTransformer
Creates a new TransmissionTest instance for testing the specified transformer.
This is the primary factory method for creating test instances. The test will use UnconfinedTestDispatcher by default for immediate execution of coroutines.
Return
A new TransmissionTest instance
Example:
val test = TransmissionTest.forTransformer(UserTransformer())
test.testSignal(UserSignal.Login("user", "pass")) { /* assertions */}
Content copied to clipboard
Parameters
transformer
The transformer to test
Creates a new TransmissionTest instance for testing the specified transformer with a custom dispatcher.
This method allows you to control coroutine execution timing by providing a custom test dispatcher. This can be useful for testing time-dependent behavior or controlling execution order.
Return
A new TransmissionTest instance
Example:
val testDispatcher = StandardTestDispatcher()
val test = TransmissionTest.forTransformer(UserTransformer(), testDispatcher)
test.testSignal(UserSignal.DelayedOperation) {
// Use testDispatcher.scheduler.advanceTimeBy() to control timing
}
Content copied to clipboard
Parameters
transformer
The transformer to test
dispatcher
The test dispatcher to use for coroutine execution