|
|
@ -67,7 +67,7 @@ class BookmarksViewModelTest {
|
|
|
|
val collectJob = launch(UnconfinedTestDispatcher()) { viewModel.feedUiState.collect() }
|
|
|
|
val collectJob = launch(UnconfinedTestDispatcher()) { viewModel.feedUiState.collect() }
|
|
|
|
|
|
|
|
|
|
|
|
newsRepository.sendNewsResources(newsResourcesTestData)
|
|
|
|
newsRepository.sendNewsResources(newsResourcesTestData)
|
|
|
|
userDataRepository.setNewsResourceBookmark(newsResourcesTestData[0].id, true)
|
|
|
|
userDataRepository.setNewsResourceBookmarked(newsResourcesTestData[0].id, true)
|
|
|
|
val item = viewModel.feedUiState.value
|
|
|
|
val item = viewModel.feedUiState.value
|
|
|
|
assertIs<Success>(item)
|
|
|
|
assertIs<Success>(item)
|
|
|
|
assertEquals(item.feed.size, 1)
|
|
|
|
assertEquals(item.feed.size, 1)
|
|
|
@ -81,7 +81,7 @@ class BookmarksViewModelTest {
|
|
|
|
// Set the news resources to be used by this test
|
|
|
|
// Set the news resources to be used by this test
|
|
|
|
newsRepository.sendNewsResources(newsResourcesTestData)
|
|
|
|
newsRepository.sendNewsResources(newsResourcesTestData)
|
|
|
|
// Start with the resource saved
|
|
|
|
// Start with the resource saved
|
|
|
|
userDataRepository.setNewsResourceBookmark(newsResourcesTestData[0].id, true)
|
|
|
|
userDataRepository.setNewsResourceBookmarked(newsResourcesTestData[0].id, true)
|
|
|
|
// Use viewModel to remove saved resource
|
|
|
|
// Use viewModel to remove saved resource
|
|
|
|
viewModel.removeFromSavedResources(newsResourcesTestData[0].id)
|
|
|
|
viewModel.removeFromSavedResources(newsResourcesTestData[0].id)
|
|
|
|
// Verify list of saved resources is now empty
|
|
|
|
// Verify list of saved resources is now empty
|
|
|
|