Add test for ChangeServerPresenter

This commit is contained in:
Benoit Marty 2023-02-07 16:57:33 +01:00
parent 41a5d599fa
commit 5ca2b475cc
4 changed files with 146 additions and 1 deletions

View file

@ -39,7 +39,8 @@ sealed interface Async<out T> {
suspend fun <T> (suspend () -> T).execute(state: MutableState<Async<T>>) {
try {
state.value = Async.Loading()
state.value = Async.Success(this())
val result = this()
state.value = Async.Success(result)
} catch (error: Throwable) {
state.value = Async.Failure(error)
}