Skip to content

Commit

Permalink
Check topicViewModelTest for spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedishayan76 committed Sep 7, 2024
1 parent 6f40606 commit 987e87f
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class TopicViewModelTest {

@Test
fun uiStateTopic_whenSuccess_matchesTopicFromRepository() = runTest {
backgroundScope.launch(UnconfinedTestDispatcher()) { viewModel.topicUiState.collect() }
backgroundScope.launch(UnconfinedTestDispatcher()) { viewModel.topicUiState.collect() }

topicsRepository.sendTopics(testInputTopics.map(FollowableTopic::topic))
userDataRepository.setFollowedTopicIds(setOf(testInputTopics[1].topic.id))
Expand All @@ -111,7 +111,7 @@ class TopicViewModelTest {

@Test
fun uiStateTopic_whenFollowedIdsSuccessAndTopicLoading_thenShowLoading() = runTest {
backgroundScope.launch(UnconfinedTestDispatcher()) { viewModel.topicUiState.collect() }
backgroundScope.launch(UnconfinedTestDispatcher()) { viewModel.topicUiState.collect() }

userDataRepository.setFollowedTopicIds(setOf(testInputTopics[1].topic.id))
assertEquals(TopicUiState.Loading, viewModel.topicUiState.value)
Expand All @@ -120,7 +120,7 @@ class TopicViewModelTest {
@Test
fun uiStateTopic_whenFollowedIdsSuccessAndTopicSuccess_thenTopicSuccessAndNewsLoading() =
runTest {
backgroundScope.launch(UnconfinedTestDispatcher()) { viewModel.topicUiState.collect() }
backgroundScope.launch(UnconfinedTestDispatcher()) { viewModel.topicUiState.collect() }

topicsRepository.sendTopics(testInputTopics.map { it.topic })
userDataRepository.setFollowedTopicIds(setOf(testInputTopics[1].topic.id))
Expand All @@ -134,7 +134,7 @@ class TopicViewModelTest {
@Test
fun uiStateTopic_whenFollowedIdsSuccessAndTopicSuccessAndNewsIsSuccess_thenAllSuccess() =
runTest {
backgroundScope.launch(UnconfinedTestDispatcher()) {
backgroundScope.launch(UnconfinedTestDispatcher()) {
combine(
viewModel.topicUiState,
viewModel.newsUiState,
Expand All @@ -153,7 +153,7 @@ class TopicViewModelTest {

@Test
fun uiStateTopic_whenFollowingTopic_thenShowUpdatedTopic() = runTest {
backgroundScope.launch(UnconfinedTestDispatcher()) { viewModel.topicUiState.collect() }
backgroundScope.launch(UnconfinedTestDispatcher()) { viewModel.topicUiState.collect() }

topicsRepository.sendTopics(testInputTopics.map { it.topic })
// Set which topic IDs are followed, not including 0.
Expand Down

0 comments on commit 987e87f

Please sign in to comment.