Skip to content

Commit

Permalink
add missing test and fix references
Browse files Browse the repository at this point in the history
  • Loading branch information
malmstein committed Jan 15, 2025
1 parent 696cda4 commit d387ef3
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import com.duckduckgo.savedsites.api.models.SavedSites
import com.duckduckgo.savedsites.api.models.SavedSitesNames
import com.duckduckgo.savedsites.api.service.SavedSitesManager
import com.duckduckgo.savedsites.impl.SavedSitesPixelName
import com.duckduckgo.savedsites.impl.store.BookmarksDataStore
import com.duckduckgo.savedsites.impl.store.SortingMode.NAME
import com.duckduckgo.sync.api.engine.SyncEngine
import com.duckduckgo.sync.api.favicons.FaviconsFetchingPrompt
import kotlinx.coroutines.flow.flowOf
Expand Down Expand Up @@ -70,6 +72,7 @@ class BookmarksViewModelTest {
private val syncEngine: SyncEngine = mock()
private val pixel: Pixel = mock()
private val faviconsFetchingPrompt: FaviconsFetchingPrompt = mock()
private val bookmarksDataStore: BookmarksDataStore = mock()

private val bookmark =
Bookmark(
Expand All @@ -92,6 +95,7 @@ class BookmarksViewModelTest {
pixel,
syncEngine,
faviconsFetchingPrompt,
bookmarksDataStore,
coroutineRule.testDispatcherProvider,
coroutineRule.testScope,
)
Expand All @@ -113,6 +117,7 @@ class BookmarksViewModelTest {
),
)

whenever(bookmarksDataStore.getSortingMode()).thenReturn(NAME)
testee.fetchBookmarksAndFolders(SavedSitesNames.BOOKMARKS_ROOT)
}

Expand Down Expand Up @@ -453,4 +458,10 @@ class BookmarksViewModelTest {

verify(pixel).fire(SavedSitesPixelName.EDIT_BOOKMARK_DELETE_BOOKMARK_CLICKED)
}

@Test
fun whenSortingModeSelectedThenDataStored() = runTest {
testee.onSortingModeSelected(NAME)
verify(bookmarksDataStore).setSortingMode(NAME)
}
}

0 comments on commit d387ef3

Please sign in to comment.