-
Notifications
You must be signed in to change notification settings - Fork 842
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PM-16695] Learn more new device verification (#4527)
Co-authored-by: André Bispo <[email protected]>
- Loading branch information
1 parent
6b6e95a
commit b5d73c9
Showing
4 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,14 @@ import androidx.compose.ui.test.assertIsOn | |
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.compose.ui.test.performClick | ||
import androidx.compose.ui.test.performScrollTo | ||
import androidx.core.net.toUri | ||
import com.x8bit.bitwarden.data.platform.repository.util.bufferedMutableSharedFlow | ||
import com.x8bit.bitwarden.ui.platform.base.BaseComposeTest | ||
import com.x8bit.bitwarden.ui.platform.manager.intent.IntentManager | ||
import io.mockk.every | ||
import io.mockk.just | ||
import io.mockk.mockk | ||
import io.mockk.runs | ||
import io.mockk.verify | ||
import junit.framework.TestCase.assertTrue | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
|
@@ -27,13 +31,18 @@ class NewDeviceNoticeEmailAccessScreenTest : BaseComposeTest() { | |
every { eventFlow } returns mutableEventFlow | ||
} | ||
|
||
private val intentManager: IntentManager = mockk { | ||
every { launchUri(any()) } just runs | ||
} | ||
|
||
@Before | ||
fun setUp() { | ||
composeTestRule.setContent { | ||
NewDeviceNoticeEmailAccessScreen( | ||
onNavigateBackToVault = { onNavigateBackToVaultCalled = true }, | ||
onNavigateToTwoFactorOptions = { onNavigateToTwoFactorOptionsCalled = true }, | ||
viewModel = viewModel, | ||
intentManager = intentManager, | ||
) | ||
} | ||
} | ||
|
@@ -91,6 +100,14 @@ class NewDeviceNoticeEmailAccessScreenTest : BaseComposeTest() { | |
mutableEventFlow.tryEmit(NewDeviceNoticeEmailAccessEvent.NavigateToTwoFactorOptions) | ||
assertTrue(onNavigateToTwoFactorOptionsCalled) | ||
} | ||
|
||
@Test | ||
fun `on NavigateToLearnMore should call launchUri on IntentManager`() { | ||
mutableEventFlow.tryEmit(NewDeviceNoticeEmailAccessEvent.NavigateToLearnMore) | ||
verify { | ||
intentManager.launchUri("https://bitwarden.com/help/new-device-verification/".toUri()) | ||
} | ||
} | ||
} | ||
|
||
private const val EMAIL = "[email protected]" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters