@@ -30,6 +30,7 @@ import com.x8bit.bitwarden.ui.platform.manager.biometrics.BiometricsManager
30
30
import com.x8bit.bitwarden.ui.platform.manager.intent.IntentManager
31
31
import com.x8bit.bitwarden.ui.util.assertNoDialogExists
32
32
import com.x8bit.bitwarden.ui.util.assertNoPopupExists
33
+ import io.mockk.coEvery
33
34
import io.mockk.every
34
35
import io.mockk.just
35
36
import io.mockk.mockk
@@ -241,6 +242,55 @@ class AccountSecurityScreenTest : BaseComposeTest() {
241
242
composeTestRule.onNodeWithText(" Unlock with Biometrics" ).assertIsOn()
242
243
}
243
244
245
+ @Suppress(" MaxLineLength" )
246
+ @Test
247
+ fun `unlock option section should be displayed according to state if biometrics is available` () {
248
+ val section = " UNLOCK OPTIONS"
249
+ composeTestRule.onNodeWithText(section).performScrollTo().assertIsDisplayed()
250
+
251
+ mutableStateFlow.update {
252
+ DEFAULT_STATE .copy(
253
+ removeUnlockWithPinPolicyEnabled = true ,
254
+ isUnlockWithPinEnabled = true ,
255
+ )
256
+ }
257
+ composeTestRule.onNodeWithText(section).performScrollTo().assertIsDisplayed()
258
+
259
+ mutableStateFlow.update {
260
+ DEFAULT_STATE .copy(
261
+ removeUnlockWithPinPolicyEnabled = true ,
262
+ isUnlockWithPinEnabled = false ,
263
+ )
264
+ }
265
+ composeTestRule.onNodeWithText(section).performScrollTo().assertIsDisplayed()
266
+ }
267
+
268
+ @Suppress(" MaxLineLength" )
269
+ @Test
270
+ fun `unlock option section should be displayed according to state if biometrics is not available` () {
271
+ coEvery {
272
+ biometricsManager.biometricSupportStatus
273
+ } returns BiometricSupportStatus .NOT_SUPPORTED
274
+ val section = " UNLOCK OPTIONS"
275
+
276
+ composeTestRule.onNodeWithText(section).performScrollTo().assertIsDisplayed()
277
+ mutableStateFlow.update {
278
+ DEFAULT_STATE .copy(
279
+ removeUnlockWithPinPolicyEnabled = true ,
280
+ isUnlockWithPinEnabled = true ,
281
+ )
282
+ }
283
+ composeTestRule.onNodeWithText(section).performScrollTo().assertIsDisplayed()
284
+
285
+ mutableStateFlow.update {
286
+ DEFAULT_STATE .copy(
287
+ removeUnlockWithPinPolicyEnabled = true ,
288
+ isUnlockWithPinEnabled = false ,
289
+ )
290
+ }
291
+ composeTestRule.onNodeWithText(section).assertDoesNotExist()
292
+ }
293
+
244
294
@Test
245
295
fun `unlock with pin toggle should be displayed according to state` () {
246
296
val toggleText = " Unlock with PIN code"
0 commit comments