Skip to content

Commit 4a20d39

Browse files
committed
Add more tests
1 parent f0558c4 commit 4a20d39

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

autofill/autofill-impl/src/test/java/com/duckduckgo/autofill/impl/SecureStoreBackedAutofillStoreTest.kt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import org.junit.Test
5959
import org.junit.runner.RunWith
6060
import org.mockito.Mock
6161
import org.mockito.MockitoAnnotations
62+
import org.mockito.kotlin.verify
6263
import org.mockito.kotlin.whenever
6364

6465
@SuppressLint("DenyListedApi")
@@ -701,6 +702,34 @@ class SecureStoreBackedAutofillStoreTest {
701702
assertEquals(DEFAULT_INITIAL_LAST_UPDATED, updated.lastUpdatedMillis)
702703
}
703704

705+
@Test
706+
fun whenUserHasNeverImportedPasswordThenCallsThroughToStoreCorrectly() = runTest {
707+
setupTesteeWithAutofillAvailable()
708+
testee.hasEverImportedPasswords
709+
verify(autofillPrefsStore).hasEverImportedPasswords
710+
}
711+
712+
@Test
713+
fun whenUserHasImportedPasswordThenCallsThroughToStoreCorrectly() = runTest {
714+
setupTesteeWithAutofillAvailable()
715+
testee.hasEverImportedPasswords = true
716+
verify(autofillPrefsStore).hasEverImportedPasswords = true
717+
}
718+
719+
@Test
720+
fun whenUserHasNeverDismissedImportPasswordPromoThenCallsThroughToStoreCorrectly() = runTest {
721+
setupTesteeWithAutofillAvailable()
722+
testee.hasDismissedImportedPasswordsPromo
723+
verify(autofillPrefsStore).hasDismissedImportedPasswordsPromo
724+
}
725+
726+
@Test
727+
fun whenUserHasDismissedImportPasswordPromoThenCallsThroughToStoreCorrectly() = runTest {
728+
setupTesteeWithAutofillAvailable()
729+
testee.hasDismissedImportedPasswordsPromo = true
730+
verify(autofillPrefsStore).hasDismissedImportedPasswordsPromo = true
731+
}
732+
704733
private fun enableDeepDomainCheckFeatureFlag() {
705734
autofillFeature.deepDomainComparisonsOnExistingCredentialsChecks().setRawStoredState(State(true))
706735
}

0 commit comments

Comments
 (0)