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 2159a3a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
8 changes: 4 additions & 4 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
Must be exported in order to be launchable.
-->
<activity android:name="net.mullvad.mullvadvpn.ui.MainActivity"
android:configChanges="orientation|screenSize|screenLayout"
android:screenOrientation="fullUser"
android:exported="true"
android:launchMode="singleTask"
android:configChanges="orientation|screenSize|screenLayout"
android:screenOrientation="fullUser"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down Expand Up @@ -76,9 +76,9 @@
-->
<service android:name="net.mullvad.mullvadvpn.tile.MullvadTileService"
android:exported="true"
android:icon="@drawable/small_logo_black"
android:label="@string/toggle_vpn"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:label="@string/toggle_vpn"
android:icon="@drawable/small_logo_black"
android:process=":mullvadvpn_tile">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
Expand Down
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 2159a3a

Please sign in to comment.