Merge pull request #1256 from lnbs97/main

Fix typo in TopicViewModel.kt
pull/1274/head
Don Turner 9 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(), viewModel: TopicViewModel = hiltViewModel(),
) { ) {
val topicUiState: TopicUiState by viewModel.topicUiState.collectAsStateWithLifecycle() 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}") TrackScreenViewEvent(screenName = "Topic: ${viewModel.topicId}")
TopicScreen( TopicScreen(

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

@ -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)

Loading…
Cancel
Save