mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-07-03 08:08:48 +00:00
Fix tests
This commit is contained in:
parent
8ecd6e6b98
commit
5887438dde
|
@ -3,7 +3,7 @@ package org.schabi.newpipe.database
|
|||
import android.content.Context
|
||||
import androidx.room.Room
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNotNull
|
||||
|
@ -22,7 +22,6 @@ import org.schabi.newpipe.extractor.channel.ChannelInfo
|
|||
import org.schabi.newpipe.extractor.stream.StreamType
|
||||
import java.io.IOException
|
||||
import java.time.OffsetDateTime
|
||||
import kotlin.streams.toList
|
||||
|
||||
class FeedDAOTest {
|
||||
private lateinit var db: AppDatabase
|
||||
|
@ -94,17 +93,13 @@ class FeedDAOTest {
|
|||
)
|
||||
}
|
||||
|
||||
private fun setupUnlinkDelete(time: String) {
|
||||
private fun setupUnlinkDelete(time: String) = runBlocking {
|
||||
clearAndFillTables()
|
||||
Single.fromCallable {
|
||||
feedDAO.unlinkStreamsOlderThan(OffsetDateTime.parse(time))
|
||||
}.blockingSubscribe()
|
||||
Single.fromCallable {
|
||||
streamDAO.deleteOrphans()
|
||||
}.blockingSubscribe()
|
||||
feedDAO.unlinkStreamsOlderThan(OffsetDateTime.parse(time))
|
||||
streamDAO.deleteOrphans()
|
||||
}
|
||||
|
||||
private fun clearAndFillTables() {
|
||||
private suspend fun clearAndFillTables() {
|
||||
db.clearAllTables()
|
||||
streamDAO.insertAll(allStreams)
|
||||
subscriptionDAO.insertAll(
|
||||
|
|
Loading…
Reference in New Issue
Block a user