Merge pull request #453 from LinX64/no_bookmarks_state_test

[Saved screen] Added the test for empty state and refactor
pull/470/head
Don Turner 2 years ago committed by GitHub
commit 4484743830
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,7 +17,6 @@
package com.google.samples.apps.nowinandroid.feature.bookmarks
import androidx.activity.ComponentActivity
import androidx.compose.material3.windowsizeclass.WindowSizeClass
import androidx.compose.ui.test.assertCountEquals
import androidx.compose.ui.test.assertHasClickAction
import androidx.compose.ui.test.filter
@ -65,8 +64,6 @@ class BookmarksScreenTest {
@Test
fun feed_whenHasBookmarks_showsBookmarks() {
lateinit var windowSizeClass: WindowSizeClass
composeTestRule.setContent {
BookmarksScreen(
feedState = NewsFeedUiState.Success(
@ -138,4 +135,26 @@ class BookmarksScreenTest {
assertTrue(removeFromBookmarksCalled)
}
@Test
fun feed_whenHasNoBookmarks_showsEmptyState() {
composeTestRule.setContent {
BookmarksScreen(
feedState = NewsFeedUiState.Success(emptyList()),
removeFromBookmarks = { }
)
}
composeTestRule
.onNodeWithText(
composeTestRule.activity.getString(R.string.bookmarks_empty_error)
)
.assertExists()
composeTestRule
.onNodeWithText(
composeTestRule.activity.getString(R.string.bookmarks_empty_description)
)
.assertExists()
}
}

Loading…
Cancel
Save