|
|
@ -93,7 +93,7 @@ class BookmarksViewModelTest {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
fun feedUiState_resourceIsViewed_setResourcesViewed() = runTest {
|
|
|
|
fun feedUiState_resourceIsViewed_setResourcesViewed() = runTest {
|
|
|
|
val collectJob = launch(UnconfinedTestDispatcher()) { viewModel.feedUiState.collect() }
|
|
|
|
backgroundScope.launch(UnconfinedTestDispatcher()) { viewModel.feedUiState.collect() }
|
|
|
|
|
|
|
|
|
|
|
|
// Given
|
|
|
|
// Given
|
|
|
|
newsRepository.sendNewsResources(newsResourcesTestData)
|
|
|
|
newsRepository.sendNewsResources(newsResourcesTestData)
|
|
|
@ -109,13 +109,11 @@ class BookmarksViewModelTest {
|
|
|
|
val item = viewModel.feedUiState.value
|
|
|
|
val item = viewModel.feedUiState.value
|
|
|
|
assertIs<Success>(item)
|
|
|
|
assertIs<Success>(item)
|
|
|
|
assertTrue(item.feed.first().hasBeenViewed)
|
|
|
|
assertTrue(item.feed.first().hasBeenViewed)
|
|
|
|
|
|
|
|
|
|
|
|
collectJob.cancel()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
fun feedUiState_undoneBookmarkRemoval_bookmarkIsRestored() = runTest {
|
|
|
|
fun feedUiState_undoneBookmarkRemoval_bookmarkIsRestored() = runTest {
|
|
|
|
val collectJob = launch(UnconfinedTestDispatcher()) { viewModel.feedUiState.collect() }
|
|
|
|
launch(UnconfinedTestDispatcher()) { viewModel.feedUiState.collect() }
|
|
|
|
|
|
|
|
|
|
|
|
// Given
|
|
|
|
// Given
|
|
|
|
newsRepository.sendNewsResources(newsResourcesTestData)
|
|
|
|
newsRepository.sendNewsResources(newsResourcesTestData)
|
|
|
@ -134,7 +132,5 @@ class BookmarksViewModelTest {
|
|
|
|
val item = viewModel.feedUiState.value
|
|
|
|
val item = viewModel.feedUiState.value
|
|
|
|
assertIs<Success>(item)
|
|
|
|
assertIs<Success>(item)
|
|
|
|
assertEquals(1, item.feed.size)
|
|
|
|
assertEquals(1, item.feed.size)
|
|
|
|
|
|
|
|
|
|
|
|
collectJob.cancel()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|