Skip to content

Commit f193e07

Browse files
committed
Address new code review comments
1 parent fedb8b7 commit f193e07

26 files changed

Lines changed: 632 additions & 518 deletions

.editorconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ ij_kotlin_allow_trailing_comma_on_call_site = true
1414
ij_kotlin_name_count_to_use_star_import = 2147483647
1515
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
1616
ij_kotlin_packages_to_use_import_on_demand = unset
17-
ktlint_class_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = 1
1817
ij_kotlin_line_break_after_multiline_when_entry = false
1918
ktlint_code_style = android_studio
2019
ktlint_class_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = 1
@@ -24,4 +23,4 @@ ktlint_standard_function-expression-body = disabled
2423
ktlint_standard_function-signature = disabled
2524
ktlint_standard_trailing-comma-on-call-site = disabled
2625
ktlint_standard_blank-line-between-when-conditions = disabled
27-
max_line_length = 100
26+
max_line_length = 100

app/src/test/kotlin/com/android/contacts/sim/SimImportScreenTest.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import com.android.contacts.ui.simimport.screen.model.SIM_IMPORT_CONTACTS_TO_IMP
2222
import com.android.contacts.ui.simimport.screen.model.SIM_IMPORT_DESELECT_ALL_TEST_TAG
2323
import com.android.contacts.ui.simimport.screen.model.SIM_IMPORT_IMPORT_BUTTON_TEST_TAG
2424
import com.android.contacts.ui.simimport.screen.model.SIM_IMPORT_SELECT_ALL_TEST_TAG
25-
import com.android.contacts.ui.simimport.screen.model.SimImportAction
26-
import com.android.contacts.ui.simimport.screen.model.SimImportUiState
25+
import com.android.contacts.ui.simimport.screen.model.SimImportAction as Action
26+
import com.android.contacts.ui.simimport.screen.model.SimImportUiState as State
2727
import io.mockk.every
2828
import io.mockk.mockk
2929
import io.mockk.verify
@@ -38,7 +38,7 @@ import org.robolectric.RobolectricTestRunner
3838
@RunWith(RobolectricTestRunner::class)
3939
class SimImportScreenTest {
4040

41-
private val fakeUiStateFlow = MutableStateFlow(SimImportUiState())
41+
private val fakeUiStateFlow = MutableStateFlow<State>(State.Loading)
4242
private lateinit var screenModel: SimImportScreenModel
4343
private lateinit var effectHandler: SimImportEffectHandler
4444

@@ -52,7 +52,7 @@ class SimImportScreenTest {
5252
@Test
5353
fun showCurrentAccount() = runComposeUiTest {
5454
val account = AccountUiModelFactory.build()
55-
fakeUiStateFlow.value = SimImportUiState(
55+
fakeUiStateFlow.value = State.Ready(
5656
accounts = persistentListOf(account),
5757
currentAccount = account,
5858
)
@@ -66,7 +66,7 @@ class SimImportScreenTest {
6666
fun pickAnotherAccount() = runComposeUiTest {
6767
val account1 = AccountUiModelFactory.build(name = "First")
6868
val account2 = AccountUiModelFactory.build(name = "Second")
69-
fakeUiStateFlow.value = SimImportUiState(
69+
fakeUiStateFlow.value = State.Ready(
7070
accounts = persistentListOf(account1, account2),
7171
currentAccount = account1,
7272
)
@@ -79,14 +79,14 @@ class SimImportScreenTest {
7979
hasText(account2.name!!)
8080
.and(hasTestTag(SIM_IMPORT_ACCOUNT_PICKER_MENU_ITEM_TEST_TAG)),
8181
).performClick()
82-
verify { screenModel.onAction(SimImportAction.AccountChanged(account2)) }
82+
verify { screenModel.onAction(Action.AccountChanged(account2)) }
8383
}
8484

8585
@Test
8686
fun showContactToImport() = runComposeUiTest {
8787
val account = AccountUiModelFactory.build()
8888
val contact = SimContactUiModelFactory.build()
89-
fakeUiStateFlow.value = SimImportUiState(
89+
fakeUiStateFlow.value = State.Ready(
9090
accounts = persistentListOf(account),
9191
currentAccount = account,
9292
contactsToImport = persistentListOf(SelectableItem(contact, false)),
@@ -103,7 +103,7 @@ class SimImportScreenTest {
103103
fun clickContact() = runComposeUiTest {
104104
val account = AccountUiModelFactory.build()
105105
val contact = SimContactUiModelFactory.build()
106-
fakeUiStateFlow.value = SimImportUiState(
106+
fakeUiStateFlow.value = State.Ready(
107107
accounts = persistentListOf(account),
108108
currentAccount = account,
109109
contactsToImport = persistentListOf(SelectableItem(contact, false)),
@@ -113,13 +113,13 @@ class SimImportScreenTest {
113113
setScreenContent()
114114

115115
onNodeWithText(contact.label).performClick()
116-
verify { screenModel.onAction(SimImportAction.ContactSelectionChanged(contact, true)) }
116+
verify { screenModel.onAction(Action.ContactSelectionChanged(contact, true)) }
117117
}
118118

119119
@Test
120120
fun checkTopBarActionsCanBeDisabled() = runComposeUiTest {
121121
val account = AccountUiModelFactory.build()
122-
fakeUiStateFlow.value = SimImportUiState(
122+
fakeUiStateFlow.value = State.Ready(
123123
accounts = persistentListOf(account),
124124
currentAccount = account,
125125
contactsToImport = persistentListOf(),

0 commit comments

Comments
 (0)