@@ -303,10 +303,10 @@ class FirstTimeActionManagerTest {
303
303
304
304
@Test
305
305
fun `shouldShowAddLoginCoachMarkFlow updates when disk source updates` () = runTest {
306
+ fakeAuthDiskSource.userState = MOCK_USER_STATE
306
307
// Enable the feature for this test.
307
308
mutableOnboardingFeatureFlow.update { true }
308
309
firstTimeActionManager.shouldShowAddLoginCoachMarkFlow.test {
309
- // Null will be mapped to false.
310
310
assertTrue(awaitItem())
311
311
fakeSettingsDiskSource.storeShouldShowAddLoginCoachMark(shouldShow = false )
312
312
assertFalse(awaitItem())
@@ -316,15 +316,45 @@ class FirstTimeActionManagerTest {
316
316
@Test
317
317
fun `shouldShowAddLoginCoachMarkFlow updates when feature flag for onboarding updates` () =
318
318
runTest {
319
+ fakeAuthDiskSource.userState = MOCK_USER_STATE
319
320
firstTimeActionManager.shouldShowAddLoginCoachMarkFlow.test {
320
- // Null will be mapped to false but feature being "off" will override to true.
321
321
assertFalse(awaitItem())
322
322
mutableOnboardingFeatureFlow.update { true }
323
- // Will use the value from disk source (null ?: false).
324
323
assertTrue(awaitItem())
325
324
}
326
325
}
327
326
327
+ @Suppress(" MaxLineLength" )
328
+ @Test
329
+ fun `if there are any login ciphers available for the active user should not show add login coach marks` () =
330
+ runTest {
331
+ val mockJsonWithNoLogin = mockk<SyncResponseJson .Cipher > {
332
+ every { login } returns null
333
+ }
334
+ val mockJsonWithLogin = mockk<SyncResponseJson .Cipher > {
335
+ every { login } returns mockk()
336
+ }
337
+ fakeAuthDiskSource.userState = MOCK_USER_STATE
338
+ // Enable feature flag so flow emits updates from disk.
339
+ mutableOnboardingFeatureFlow.update { true }
340
+ mutableCiphersListFlow.update {
341
+ listOf (
342
+ mockJsonWithNoLogin,
343
+ mockJsonWithNoLogin,
344
+ )
345
+ }
346
+ firstTimeActionManager.shouldShowAddLoginCoachMarkFlow.test {
347
+ assertTrue(awaitItem())
348
+ mutableCiphersListFlow.update {
349
+ listOf (
350
+ mockJsonWithLogin,
351
+ mockJsonWithNoLogin,
352
+ )
353
+ }
354
+ assertFalse(awaitItem())
355
+ }
356
+ }
357
+
328
358
@Suppress(" MaxLineLength" )
329
359
@Test
330
360
fun `markCoachMarkTourCompleted for the ADD_LOGIN type sets the value to true in the disk source for should show add logins coach mark` () {
@@ -335,10 +365,10 @@ class FirstTimeActionManagerTest {
335
365
336
366
@Test
337
367
fun `shouldShowGeneratorCoachMarkFlow updates when disk source updates` () = runTest {
368
+ fakeAuthDiskSource.userState = MOCK_USER_STATE
338
369
// Enable feature flag so flow emits updates from disk.
339
370
mutableOnboardingFeatureFlow.update { true }
340
371
firstTimeActionManager.shouldShowGeneratorCoachMarkFlow.test {
341
- // Null will be mapped to false.
342
372
assertTrue(awaitItem())
343
373
fakeSettingsDiskSource.storeShouldShowGeneratorCoachMark(shouldShow = false )
344
374
assertFalse(awaitItem())
@@ -348,15 +378,46 @@ class FirstTimeActionManagerTest {
348
378
@Test
349
379
fun `shouldShowGeneratorCoachMarkFlow updates when onboarding feature value changes` () =
350
380
runTest {
381
+ fakeAuthDiskSource.userState = MOCK_USER_STATE
351
382
firstTimeActionManager.shouldShowGeneratorCoachMarkFlow.test {
352
- // Null will be mapped to false
353
383
assertFalse(awaitItem())
354
384
mutableOnboardingFeatureFlow.update { true }
355
385
// Take the value from disk.
356
386
assertTrue(awaitItem())
357
387
}
358
388
}
359
389
390
+ @Suppress(" MaxLineLength" )
391
+ @Test
392
+ fun `if there are any login ciphers available for the active user should not show generator coach marks` () =
393
+ runTest {
394
+ val mockJsonWithNoLogin = mockk<SyncResponseJson .Cipher > {
395
+ every { login } returns null
396
+ }
397
+ val mockJsonWithLogin = mockk<SyncResponseJson .Cipher > {
398
+ every { login } returns mockk()
399
+ }
400
+ fakeAuthDiskSource.userState = MOCK_USER_STATE
401
+ // Enable feature flag so flow emits updates from disk.
402
+ mutableOnboardingFeatureFlow.update { true }
403
+ mutableCiphersListFlow.update {
404
+ listOf (
405
+ mockJsonWithNoLogin,
406
+ mockJsonWithNoLogin,
407
+ )
408
+ }
409
+ firstTimeActionManager.shouldShowGeneratorCoachMarkFlow.test {
410
+ assertTrue(awaitItem())
411
+ mutableCiphersListFlow.update {
412
+ listOf (
413
+ mockJsonWithLogin,
414
+ mockJsonWithNoLogin,
415
+ )
416
+ }
417
+ assertFalse(awaitItem())
418
+ }
419
+ }
420
+
360
421
@Suppress(" MaxLineLength" )
361
422
@Test
362
423
fun `markCoachMarkTourCompleted for the GENERATOR type sets the value to true in the disk source for should show generator coach mark` () {
0 commit comments