diff --git a/feature/topic/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/topic/TopicScreenTest.kt b/feature/topic/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/topic/TopicScreenTest.kt index 855d753b9..f5535e532 100644 --- a/feature/topic/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/topic/TopicScreenTest.kt +++ b/feature/topic/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/topic/TopicScreenTest.kt @@ -27,6 +27,7 @@ import androidx.compose.ui.test.performScrollToNode import com.google.samples.apps.nowinandroid.core.model.data.FollowableTopic import com.google.samples.apps.nowinandroid.core.model.data.NewsResource import com.google.samples.apps.nowinandroid.core.model.data.NewsResourceType.Video +import com.google.samples.apps.nowinandroid.core.model.data.SaveableNewsResource import com.google.samples.apps.nowinandroid.core.model.data.Topic import kotlinx.datetime.Instant import org.junit.Before @@ -57,9 +58,10 @@ class TopicScreenTest { composeTestRule.setContent { TopicScreen( topicState = TopicUiState.Loading, - newsState = NewsUiState.Loading, + newsUiState = NewsUiState.Loading, onBackClick = { }, - onFollowClick = { } + onFollowClick = { }, + onBookmarkChanged = { _, _ -> }, ) } @@ -74,9 +76,10 @@ class TopicScreenTest { composeTestRule.setContent { TopicScreen( topicState = TopicUiState.Success(testTopic), - newsState = NewsUiState.Loading, + newsUiState = NewsUiState.Loading, onBackClick = { }, - onFollowClick = { } + onFollowClick = { }, + onBookmarkChanged = { _, _ -> }, ) } @@ -96,9 +99,15 @@ class TopicScreenTest { composeTestRule.setContent { TopicScreen( topicState = TopicUiState.Loading, - newsState = NewsUiState.Success(sampleNewsResources), + newsUiState = NewsUiState.Success(sampleNewsResources.mapIndexed { index, newsResource -> + SaveableNewsResource( + newsResource = newsResource, + isSaved = index % 2 == 0, + ) + }), onBackClick = { }, - onFollowClick = { } + onFollowClick = { }, + onBookmarkChanged = { _, _ -> }, ) } @@ -107,15 +116,22 @@ class TopicScreenTest { .onNodeWithContentDescription(topicLoading) .assertExists() } + @Test fun news_whenSuccessAndTopicIsSuccess_isShown() { val testTopic = testTopics.first() composeTestRule.setContent { TopicScreen( topicState = TopicUiState.Success(testTopic), - newsState = NewsUiState.Success(sampleNewsResources), + newsUiState = NewsUiState.Success(sampleNewsResources.mapIndexed { index, newsResource -> + SaveableNewsResource( + newsResource = newsResource, + isSaved = index % 2 == 0, + ) + }), onBackClick = { }, - onFollowClick = { } + onFollowClick = { }, + onBookmarkChanged = { _, _ -> }, ) }