Merge pull request #1256 from lnbs97/main

Fix typo in TopicViewModel.kt
pull/1274/head
Don Turner 10 months ago committed by GitHub
commit 547cb191d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -79,7 +79,7 @@ internal fun TopicRoute(
viewModel: TopicViewModel = hiltViewModel(),
) {
val topicUiState: TopicUiState by viewModel.topicUiState.collectAsStateWithLifecycle()
val newsUiState: NewsUiState by viewModel.newUiState.collectAsStateWithLifecycle()
val newsUiState: NewsUiState by viewModel.newsUiState.collectAsStateWithLifecycle()
TrackScreenViewEvent(screenName = "Topic: ${viewModel.topicId}")
TopicScreen(

@ -62,7 +62,7 @@ class TopicViewModel @Inject constructor(
initialValue = TopicUiState.Loading,
)
val newUiState: StateFlow<NewsUiState> = newsUiState(
val newsUiState: StateFlow<NewsUiState> = newsUiState(
topicId = topicArgs.topicId,
userDataRepository = userDataRepository,
userNewsResourceRepository = userNewsResourceRepository,

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

Loading…
Cancel
Save