Oleksii Malovanyi
06/30/2021, 3:14 PMexceptionHandler
is never used so any exception would go to the TestCoroutineExceptionHandler
which would fail the test afterwards (runBlockingTest is used)InterceptingContainerDecorator
and SuspendingTestContainerHost#suspendingIntent
-> the latest receives the intent in the context of the test which, of course, ignores the Settings’s exceptionHandler
withContext
wrap in case there is settings.exceptionHandler
exists – smth similar to the what RealContainer does@Suppress("EXPERIMENTAL_API_USAGE")
private suspend fun <STATE : Any, SIDE_EFFECT : Any, T : ContainerHost<STATE, SIDE_EFFECT>> T.suspendingIntent(
shouldIsolateFlow: Boolean,
block: T.() -> Unit
) {
val testContainer = container.findTestContainer()
this.block() // Invoke the Intent
if (testContainer.savedIntents.isEmpty) {
throw IllegalArgumentException("testIntent block must invoke an orbit intent!")
}
var firstIntentExecuted = false
while (!testContainer.savedIntents.isEmpty) {
val intent = testContainer.savedIntents.receive()
if (!shouldIsolateFlow || !firstIntentExecuted) {
firstIntentExecuted = true
// WRAP withContext() here
intent()
}
}
}
Mikolaj Leszczynski
07/01/2021, 9:06 PMorbit
function level, and not the container scope level?Oleksii Malovanyi
07/02/2021, 7:22 AMMikolaj Leszczynski
07/02/2021, 7:35 AMOleksii Malovanyi
07/02/2021, 7:56 AMMikolaj Leszczynski
07/02/2021, 7:57 AMOleksii Malovanyi
07/02/2021, 8:34 AMMikolaj Leszczynski
07/02/2021, 8:35 AMOleksii Malovanyi
07/02/2021, 8:37 AMMikolaj Leszczynski
07/02/2021, 8:37 AMOleksii Malovanyi
07/02/2021, 8:38 AMMikolaj Leszczynski
07/02/2021, 8:38 AMOleksii Malovanyi
07/02/2021, 8:41 AMmiqbaldc
07/02/2021, 8:35 PM