mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-01 18:04:35 -05:00
Fix tests (#2049)
* Fix test setup * Fix tests * Disable broken CloudflareTest * Add a basic test for Android's Looper
This commit is contained in:
@@ -7,12 +7,21 @@ package suwayomi.tachidesk.manga.model.dataclass
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import java.util.Objects
|
||||
import kotlin.math.min
|
||||
|
||||
open class PaginatedList<T>(
|
||||
val page: List<T>,
|
||||
val hasNextPage: Boolean,
|
||||
)
|
||||
) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is PaginatedList<T>) return false
|
||||
return page == other.page && hasNextPage == other.hasNextPage
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = Objects.hash(page, hasNextPage)
|
||||
}
|
||||
|
||||
const val PAGINATION_FACTOR = 50
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import eu.kanade.tachiyomi.source.local.LocalSource
|
||||
import io.github.config4k.toConfig
|
||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||
import io.javalin.json.JavalinJackson
|
||||
import io.javalin.json.JavalinJackson3
|
||||
import io.javalin.json.JsonMapper
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
@@ -222,7 +222,7 @@ fun serverModule(applicationDirs: ApplicationDirs): Module =
|
||||
module {
|
||||
single { applicationDirs }
|
||||
single<IUpdater> { Updater() }
|
||||
single<JsonMapper> { JavalinJackson() }
|
||||
single<JsonMapper> { JavalinJackson3() }
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
|
||||
@@ -144,14 +144,15 @@ object DBManager {
|
||||
|
||||
private val logger = KotlinLogging.logger {}
|
||||
|
||||
fun databaseUp() {
|
||||
fun databaseUp(givenDb: Database? = null) {
|
||||
val db =
|
||||
try {
|
||||
DBManager.setupDatabase()
|
||||
} catch (e: Exception) {
|
||||
logger.error(e) { "Failed to setup Database" }
|
||||
return
|
||||
}
|
||||
givenDb
|
||||
?: try {
|
||||
DBManager.setupDatabase()
|
||||
} catch (e: Exception) {
|
||||
logger.error(e) { "Failed to setup Database" }
|
||||
return
|
||||
}
|
||||
|
||||
logger.info {
|
||||
"Using ${db.vendor} database version ${db.version}"
|
||||
|
||||
Reference in New Issue
Block a user