Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adhiamboperes committed Oct 15, 2024
1 parent b30dd7e commit fd3a10c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,10 @@ class ClassroomListFragmentPresenter @Inject constructor(
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun ClassroomListScreen() {
val groupedItems = (classroomListViewModel.homeItemViewModelListLiveData.value.orEmpty()
+ classroomListViewModel.topicList)
val groupedItems = (
classroomListViewModel.homeItemViewModelListLiveData.value.orEmpty() +
classroomListViewModel.topicList
)
.groupBy { it::class }
val topicListSpanCount = integerResource(id = R.integer.home_span_count)
val listState = rememberLazyListState()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ class ClassroomListFragmentTest {
setUpTestApplicationComponent()
logIntoAdminTwice()
scenario = ActivityScenario.launch(ClassroomListActivity::class.java)
testCoroutineDispatchers.runCurrent()

composeRule.onNodeWithTag(WELCOME_TEST_TAG).assertIsDisplayed()
composeRule.onNodeWithTag(PROMOTED_STORY_LIST_HEADER_TEST_TAG).assertIsDisplayed()
Expand Down Expand Up @@ -858,6 +859,7 @@ class ClassroomListFragmentTest {
fun testFragment_clickTopicSummary_opensTopicActivityThroughPlayIntent() {
setUpTestApplicationComponent()
scenario = ActivityScenario.launch(ClassroomListActivity::class.java)
testCoroutineDispatchers.runCurrent()

composeRule.onNodeWithTag(CLASSROOM_LIST_TEST_TAG).onChildAt(0).performClick()
testCoroutineDispatchers.runCurrent()
Expand Down Expand Up @@ -912,6 +914,8 @@ class ClassroomListFragmentTest {
fun testFragment_switchClassroom_topicListUpdatesCorrectly() {
setUpTestApplicationComponent()
scenario = ActivityScenario.launch(ClassroomListActivity::class.java)
testCoroutineDispatchers.runCurrent()

// Click on Science classroom card.
composeRule.onNodeWithTag(CLASSROOM_LIST_TEST_TAG).onChildAt(0).performClick()
testCoroutineDispatchers.runCurrent()
Expand Down

0 comments on commit fd3a10c

Please sign in to comment.