Skip to content

Commit cf9cf1d

Browse files
committed
Fix test
1 parent 33e77ce commit cf9cf1d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

feature/topic/src/test/java/com/google/samples/apps/nowinandroid/feature/topic/TopicViewModelTest.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import com.google.samples.apps.nowinandroid.core.testing.repository.TestUserData
2727
import com.google.samples.apps.nowinandroid.core.testing.util.MainDispatcherRule
2828
import com.google.samples.apps.nowinandroid.feature.topic.navigation.TopicDestination
2929
import kotlinx.coroutines.flow.collect
30+
import kotlinx.coroutines.flow.combine
3031
import kotlinx.coroutines.flow.first
3132
import kotlinx.coroutines.launch
3233
import kotlinx.coroutines.test.UnconfinedTestDispatcher
@@ -121,8 +122,13 @@ class TopicViewModelTest {
121122
@Test
122123
fun uiStateTopic_whenFollowedIdsSuccessAndTopicSuccessAndNewsIsSuccess_thenAllSuccess() =
123124
runTest {
124-
val collectJob = launch(UnconfinedTestDispatcher()) { viewModel.topicUiState.collect() }
125-
125+
val collectJob = launch(UnconfinedTestDispatcher()) {
126+
combine(
127+
viewModel.topicUiState,
128+
viewModel.newUiState,
129+
::Pair
130+
).collect()
131+
}
126132
topicsRepository.sendTopics(testInputTopics.map { it.topic })
127133
userDataRepository.setFollowedTopicIds(setOf(testInputTopics[1].topic.id))
128134
newsRepository.sendNewsResources(sampleNewsResources)

0 commit comments

Comments
 (0)