File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
autofill/autofill-impl/src
main/java/com/duckduckgo/autofill/impl/importing
test/java/com/duckduckgo/autofill/impl/importing Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -86,10 +86,8 @@ class CredentialImporterImpl @Inject constructor(
86
86
87
87
skippedCredentials + = (importList.size - insertedIds.size)
88
88
89
- // Set the flag when at least one credential was successfully imported
90
- if (insertedIds.isNotEmpty()) {
91
- autofillStore.hasEverImportedPasswords = true
92
- }
89
+ // mark that the user has imported passwords at least once, regardless of the number of credentials imported
90
+ autofillStore.hasEverImportedPasswords = true
93
91
94
92
_importStatus .emit(Finished (savedCredentials = insertedIds.size, numberSkipped = skippedCredentials))
95
93
}
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ import org.junit.Rule
13
13
import org.junit.Test
14
14
import org.mockito.kotlin.any
15
15
import org.mockito.kotlin.mock
16
- import org.mockito.kotlin.never
17
16
import org.mockito.kotlin.verify
18
17
import org.mockito.kotlin.whenever
19
18
@@ -119,17 +118,17 @@ class CredentialImporterImplTest {
119
118
}
120
119
121
120
@Test
122
- fun whenImportingNoCredentialsThenHasEverImportedPasswordsIsNotSet () = runTest {
121
+ fun whenImportingNoCredentialsThenHasEverImportedPasswordsIsStillSet () = runTest {
123
122
listOf<LoginCredentials >().import()
124
- verify(autofillStore, never() ).hasEverImportedPasswords = true
123
+ verify(autofillStore).hasEverImportedPasswords = true
125
124
}
126
125
127
126
@Test
128
- fun whenImportingOnlyDuplicatesThenHasEverImportedPasswordsIsNotSet () = runTest {
127
+ fun whenImportingOnlyDuplicatesThenHasEverImportedPasswordsIsStillSet () = runTest {
129
128
val duplicatedLogin = creds(username = " username" )
130
129
duplicatedLogin.treatAsDuplicate()
131
130
listOf (duplicatedLogin).import()
132
- verify(autofillStore, never() ).hasEverImportedPasswords = true
131
+ verify(autofillStore).hasEverImportedPasswords = true
133
132
}
134
133
135
134
private suspend fun List<LoginCredentials>.import (originalListSize : Int = this.size) {
You can’t perform that action at this time.
0 commit comments