Skip to content

Commit

Permalink
fix integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Balcan committed Nov 28, 2024
1 parent 74a9379 commit bc476a9
Showing 1 changed file with 32 additions and 25 deletions.
57 changes: 32 additions & 25 deletions form/src/test/java/org/dhis2/form/ui/DataEntryIntegrationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import androidx.paging.PagingData
import io.reactivex.Flowable
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.runTest
Expand Down Expand Up @@ -256,7 +258,8 @@ class DataEntryIntegrationTest {
observedItems.last().find { it.uid == "EVENT_ORG_UNIT_UID" }?.value == "g8upMTyEZGZ",
)
assert(
observedItems.last().find { it.uid == "INPUT_NUMBER_WITH_LEGEND_UID" }?.legend == legendValueItem,
observedItems.last()
.find { it.uid == "INPUT_NUMBER_WITH_LEGEND_UID" }?.legend == legendValueItem,
)
assert(
observedItems.last().find { it.uid == "qrur9Dvnyt5" }?.value == "20",
Expand All @@ -270,6 +273,7 @@ class DataEntryIntegrationTest {
}

private fun provideMalariaCaseRegistrationEventItems(): List<FieldUiModel> {
val optionSearchFlow = MutableStateFlow("")
return listOf(
SectionUiModelImpl(
uid = "EVENT_DETAILS_SECTION_UID",
Expand Down Expand Up @@ -338,31 +342,34 @@ class DataEntryIntegrationTest {
programStageSection = "EVENT_DATA_SECTION_UID",
autocompleteList = emptyList(),
optionSetConfiguration = OptionSetConfiguration(
flow {
PagingData.from(
listOf(
OptionSetConfiguration.OptionData(
Option.builder()
.uid("rBvjJYbMCVx")
.code("Male")
.displayName("Male")
.name("Male")
.sortOrder(1)
.build(),
MetadataIconData.defaultIcon(),
optionSearchFlow,
optionSearchFlow.flatMapLatest {
flow {
PagingData.from(
listOf(
OptionSetConfiguration.OptionData(
Option.builder()
.uid("rBvjJYbMCVx")
.code("Male")
.displayName("Male")
.name("Male")
.sortOrder(1)
.build(),
MetadataIconData.defaultIcon(),
),
OptionSetConfiguration.OptionData(
Option.builder()
.uid("Mnp3oXrpAbK")
.code("Female")
.displayName("Female")
.name("Female")
.sortOrder(2)
.build(),
MetadataIconData.defaultIcon(),
),
),
OptionSetConfiguration.OptionData(
Option.builder()
.uid("Mnp3oXrpAbK")
.code("Female")
.displayName("Female")
.name("Female")
.sortOrder(2)
.build(),
MetadataIconData.defaultIcon(),
),
),
)
)
}
},
),
valueType = ValueType.MULTI_TEXT,
Expand Down

0 comments on commit bc476a9

Please sign in to comment.