Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Nov 20, 2023
1 parent 37af570 commit 529efc3
Showing 1 changed file with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,20 @@ class ReportProblemModelTest {
// Act, Assert
viewModel.uiState.test {
assertEquals(ReportProblemUiState(), awaitItem())
viewModel.onDescriptionChanged(description)
viewModel.updateDescription(description)
assertEquals(ReportProblemUiState(description = description), awaitItem())

viewModel.sendReport(email, description, true)
assertEquals(
ReportProblemUiState(email, description, SendingReportUiState.Sending),
ReportProblemUiState(SendingReportUiState.Sending, email, description),
awaitItem()
)
assertEquals(
ReportProblemUiState(email, description, SendingReportUiState.Success(null)),
ReportProblemUiState(
SendingReportUiState.Success(null),
email,
description,
),
awaitItem()
)
}
Expand All @@ -118,20 +122,28 @@ class ReportProblemModelTest {

// Act, Assert
viewModel.uiState.test {
assertEquals(awaitItem(), ReportProblemUiState("", "", null))
viewModel.onEmailChanged(email)
assertEquals(awaitItem(), ReportProblemUiState(null, "", ""))
viewModel.updateEmail(email)
awaitItem()
viewModel.onDescriptionChanged(description)
viewModel.updateDescription(description)
awaitItem()

viewModel.sendReport(email, description)

assertEquals(
ReportProblemUiState(email, description, SendingReportUiState.Sending),
ReportProblemUiState(
SendingReportUiState.Sending,
email,
description,
),
awaitItem()
)
assertEquals(
ReportProblemUiState(email, description, SendingReportUiState.Success(email)),
ReportProblemUiState(
SendingReportUiState.Success(email),
email,
description,
),
awaitItem()
)
}
Expand Down

0 comments on commit 529efc3

Please sign in to comment.