mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 12:03:09 -04:00
#3111 Added test for the delete full search
This commit is contained in:
parent
72a99f7252
commit
97166cc8b6
@ -142,4 +142,26 @@ class NewRecentSearchRoomDaoTest {
|
||||
Assertions.assertEquals(0, newRecentSearchRoomDao.search(zimId).count())
|
||||
Assertions.assertEquals(0, newRecentSearchRoomDao.search(zimId2).count())
|
||||
}
|
||||
|
||||
@Test
|
||||
@Throws(IOException::class)
|
||||
fun testDeleteAllTheTable() = runBlocking {
|
||||
val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
db = Room.inMemoryDatabaseBuilder(
|
||||
context, KiwixRoomDatabase::class.java
|
||||
).build()
|
||||
newRecentSearchRoomDao = db.newRecentSearchRoomDao()
|
||||
val searchTerm = "title"
|
||||
val searchTerm2 = "title2"
|
||||
val searchTerm3 = "title3"
|
||||
val zimId = "zimId"
|
||||
val zimId2 = "zimId2"
|
||||
newRecentSearchRoomDao.saveSearch(searchTerm, zimId)
|
||||
newRecentSearchRoomDao.saveSearch(searchTerm2, zimId2)
|
||||
newRecentSearchRoomDao.saveSearch(searchTerm3, zimId)
|
||||
newRecentSearchRoomDao.deleteSearchHistory()
|
||||
Assertions.assertEquals(0, newRecentSearchRoomDao.fullSearch().count())
|
||||
Assertions.assertEquals(0, newRecentSearchRoomDao.search(zimId).count())
|
||||
Assertions.assertEquals(0, newRecentSearchRoomDao.search(zimId2).count())
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
package org.kiwix.kiwixmobile.core.data
|
||||
|
||||
import android.util.Log
|
||||
import io.reactivex.Completable
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.Scheduler
|
||||
|
Loading…
x
Reference in New Issue
Block a user