Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class AuthViewModel(

result.fold(
onSuccess = { user -> onLoginSuccess(user) },
onFailure = { error -> onLoginFailure(error.message ?: "Erro desconhecido") }
onFailure = { onLoginFailure() }
)
}
}
Expand All @@ -64,10 +64,10 @@ class AuthViewModel(
)
}

private fun onLoginFailure(message: String) {
private fun onLoginFailure() {
_uiState.value = _uiState.value.copy(
isLoading = false,
error = message,
error = "Email ou senha inválidos. Tente novamente.",
isLoginSuccessful = false
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class PaymentViewModel(private val paymentRepository: PaymentRepository) : ViewM
onFailure = { error ->
_uiState.value = _uiState.value.copy(
isLoading = false,
error = error.message ?: "Erro ao carregar pagamentos",
error = "Não foi possível carregar seus pagamentos. Verifique sua conexão e tente novamente.",
isRefreshing = false
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class AuthViewModelTest {
awaitItem()
val failureState = awaitItem()

assertEquals(errorMessage, failureState.error)
assertEquals("Email ou senha inválidos. Tente novamente.", failureState.error)
assertFalse(failureState.isLoading)
assertNull(failureState.user)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class PaymentViewModelTest {

viewModel.uiState.test {
val state = awaitItem()
Assert.assertEquals(errorMessage, state.error)
Assert.assertEquals("Não foi possível carregar seus pagamentos. Verifique sua conexão e tente novamente.", state.error)
Assert.assertEquals(false, state.isLoading)
cancelAndIgnoreRemainingEvents()
}
Expand Down