Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
DebbieArita committed Jan 15, 2025
1 parent 0091ee7 commit 749ade5
Showing 1 changed file with 63 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.test.assertCountEquals
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.assertIsNotDisplayed
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onAllNodesWithTag
import androidx.compose.ui.test.onChildAt
Expand Down Expand Up @@ -681,4 +682,66 @@ class RegisterScreenTest {
.assertExists()
.assertIsDisplayed()
}

@Test
fun testSyncStatusPercentageProgressLimitIs100() {
val configurationRegistry: ConfigurationRegistry = Faker.buildTestConfigurationRegistry()
val registerUiState =
RegisterUiState(
screenTitle = "Register101",
isFirstTimeSync = true,
registerConfiguration =
configurationRegistry.retrieveConfiguration(ConfigType.Register, "householdRegister"),
registerId = "register101",
progressPercentage = flowOf(101),
isSyncUpload = flowOf(false),
currentSyncJobStatus =
flowOf(
CurrentSyncJobStatus.Running(
SyncJobStatus.InProgress(
syncOperation = SyncOperation.DOWNLOAD,
),
),
),
params = emptyList(),
)
val searchText = mutableStateOf(SearchQuery.emptyText)
val currentPage = mutableStateOf(0)

composeTestRule.setContent {
val data = listOf(ResourceData("1", ResourceType.Patient, emptyMap()))
val pagingItems = flowOf(PagingData.from(data)).collectAsLazyPagingItems()
RegisterScreen(
modifier = Modifier,
openDrawer = {},
onEvent = {},
registerUiState = registerUiState,
registerUiCountState =
RegisterUiCountState(
totalRecordsCount = 1,
filteredRecordsCount = 0,
pagesCount = 0,
),
appDrawerUIState =
AppDrawerUIState(
currentSyncJobStatus =
CurrentSyncJobStatus.Running(
SyncJobStatus.InProgress(
syncOperation = SyncOperation.UPLOAD,
),
),
),
onAppMainEvent = {},
searchQuery = searchText,
currentPage = currentPage,
pagingItems = pagingItems,
navController = rememberNavController(),
decodeImage = null,
)
}

composeTestRule
.onNodeWithTag(SYNC_PROGRESS_INDICATOR_TEST_TAG, useUnmergedTree = true)
.assertIsNotDisplayed()
}
}

0 comments on commit 749ade5

Please sign in to comment.