Lucas-Israel / trybnb

0 stars 0 forks source link

replace if with when to cover all results #11

Closed FilipeLipan closed 1 month ago

FilipeLipan commented 1 month ago

https://github.com/Lucas-Israel/trybnb/blob/8e504026dd19e408bed5cebadef48c296022eb45/app/src/main/java/com/betrybe/trybnb/ui/viewmodels/BookingViewModel.kt#L53-L60

val result = bookingRepository.createBooking(body)

when (result) {
    is ClientResult.ClientSuccess -> _isBookingCreationSuccess.value = true
    is ClientResult.ClientError -> {
        // Handle ClientError case here if needed
        // For now, we just ensure it's covered
    }
    // Optionally, handle other types of ClientResult if they exist
}

ApiIdlingResource.decrement()
Lucas-Israel commented 1 month ago

reminder for where to handle different cases: https://github.com/Lucas-Israel/trybnb/commit/60352a45ae8a31b3de3e6cdfe0e6675e8ea30a35