diff --git a/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/DeleteRecentSearchTest.kt b/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/DeleteRecentSearchTest.kt index 12ad3f3eb..a5ac793b8 100644 --- a/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/DeleteRecentSearchTest.kt +++ b/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/DeleteRecentSearchTest.kt @@ -22,6 +22,7 @@ import androidx.appcompat.app.AppCompatActivity import io.mockk.mockk import io.mockk.verify import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers import org.junit.jupiter.api.Test import org.kiwix.kiwixmobile.core.dao.RecentSearchRoomDao import org.kiwix.kiwixmobile.core.search.adapter.SearchListItem @@ -34,7 +35,7 @@ internal class DeleteRecentSearchTest { val searchListItem: SearchListItem = RecentSearchListItem("") val recentSearchDao: RecentSearchRoomDao = mockk() val activity: AppCompatActivity = mockk() - val viewModelScope: CoroutineScope = mockk() + val viewModelScope = CoroutineScope(Dispatchers.IO) DeleteRecentSearch( searchListItem = searchListItem, recentSearchRoomDao = recentSearchDao, diff --git a/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/SaveSearchToRecentsTest.kt b/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/SaveSearchToRecentsTest.kt index 928f9ca43..7555563de 100644 --- a/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/SaveSearchToRecentsTest.kt +++ b/core/src/test/java/org/kiwix/kiwixmobile/core/search/viewmodel/effects/SaveSearchToRecentsTest.kt @@ -23,6 +23,7 @@ import io.mockk.Called import io.mockk.mockk import io.mockk.verify import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers import org.junit.jupiter.api.Test import org.kiwix.kiwixmobile.core.dao.RecentSearchRoomDao import org.kiwix.kiwixmobile.core.search.adapter.SearchListItem.RecentSearchListItem @@ -33,7 +34,7 @@ internal class SaveSearchToRecentsTest { private val searchListItem = RecentSearchListItem("") private val activity: AppCompatActivity = mockk() - private val viewModelScope: CoroutineScope = mockk() + private val viewModelScope = CoroutineScope(Dispatchers.IO) @Test fun `invoke with null Id does nothing`() {