|
|
@ -91,7 +91,7 @@ class TopicViewModelTest {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
fun uiStateNews_whenInitialized_thenShowLoading() = runTest {
|
|
|
|
fun uiStateNews_whenInitialized_thenShowLoading() = runTest {
|
|
|
|
assertEquals(NewsUiState.Loading, viewModel.newUiState.value)
|
|
|
|
assertEquals(NewsUiState.Loading, viewModel.newsUiState.value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -117,7 +117,7 @@ class TopicViewModelTest {
|
|
|
|
topicsRepository.sendTopics(testInputTopics.map { it.topic })
|
|
|
|
topicsRepository.sendTopics(testInputTopics.map { it.topic })
|
|
|
|
userDataRepository.setFollowedTopicIds(setOf(testInputTopics[1].topic.id))
|
|
|
|
userDataRepository.setFollowedTopicIds(setOf(testInputTopics[1].topic.id))
|
|
|
|
val topicUiState = viewModel.topicUiState.value
|
|
|
|
val topicUiState = viewModel.topicUiState.value
|
|
|
|
val newsUiState = viewModel.newUiState.value
|
|
|
|
val newsUiState = viewModel.newsUiState.value
|
|
|
|
|
|
|
|
|
|
|
|
assertIs<TopicUiState.Success>(topicUiState)
|
|
|
|
assertIs<TopicUiState.Success>(topicUiState)
|
|
|
|
assertIs<NewsUiState.Loading>(newsUiState)
|
|
|
|
assertIs<NewsUiState.Loading>(newsUiState)
|
|
|
@ -131,7 +131,7 @@ class TopicViewModelTest {
|
|
|
|
val collectJob = launch(UnconfinedTestDispatcher()) {
|
|
|
|
val collectJob = launch(UnconfinedTestDispatcher()) {
|
|
|
|
combine(
|
|
|
|
combine(
|
|
|
|
viewModel.topicUiState,
|
|
|
|
viewModel.topicUiState,
|
|
|
|
viewModel.newUiState,
|
|
|
|
viewModel.newsUiState,
|
|
|
|
::Pair,
|
|
|
|
::Pair,
|
|
|
|
).collect()
|
|
|
|
).collect()
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -139,7 +139,7 @@ class TopicViewModelTest {
|
|
|
|
userDataRepository.setFollowedTopicIds(setOf(testInputTopics[1].topic.id))
|
|
|
|
userDataRepository.setFollowedTopicIds(setOf(testInputTopics[1].topic.id))
|
|
|
|
newsRepository.sendNewsResources(sampleNewsResources)
|
|
|
|
newsRepository.sendNewsResources(sampleNewsResources)
|
|
|
|
val topicUiState = viewModel.topicUiState.value
|
|
|
|
val topicUiState = viewModel.topicUiState.value
|
|
|
|
val newsUiState = viewModel.newUiState.value
|
|
|
|
val newsUiState = viewModel.newsUiState.value
|
|
|
|
|
|
|
|
|
|
|
|
assertIs<TopicUiState.Success>(topicUiState)
|
|
|
|
assertIs<TopicUiState.Success>(topicUiState)
|
|
|
|
assertIs<NewsUiState.Success>(newsUiState)
|
|
|
|
assertIs<NewsUiState.Success>(newsUiState)
|
|
|
|