Fix tests (#226)
This commit is contained in:
@@ -45,6 +45,10 @@ First Build the jar, then cd into the `scripts` directory and run `./windows-bun
|
|||||||
## Running in development mode
|
## Running in development mode
|
||||||
run `./gradlew :server:run --stacktrace` to run the server
|
run `./gradlew :server:run --stacktrace` to run the server
|
||||||
|
|
||||||
|
## Running tests
|
||||||
|
run `./gradlew :server:test` to execute all tests
|
||||||
|
to test a specific class run `./gradlew :server:test --tests <package.with.classname>`
|
||||||
|
|
||||||
## Building the android-jar maven repository
|
## Building the android-jar maven repository
|
||||||
Run `AndroidCompat/getAndroid.sh`(macOS/Linux) or `AndroidCompat/getAndroid.ps1`(Windows)
|
Run `AndroidCompat/getAndroid.sh`(macOS/Linux) or `AndroidCompat/getAndroid.ps1`(Windows)
|
||||||
from project's root directory to download and rebuild the jar file from Google's repository,
|
from project's root directory to download and rebuild the jar file from Google's repository,
|
||||||
|
|||||||
@@ -125,7 +125,11 @@ tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
useJUnit()
|
useJUnitPlatform()
|
||||||
|
testLogging {
|
||||||
|
showStandardStreams = true
|
||||||
|
events("passed", "skipped", "failed")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
named<Copy>("processResources") {
|
named<Copy>("processResources") {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import suwayomi.tachidesk.manga.impl.util.lang.awaitSingle
|
|||||||
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSource
|
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSource
|
||||||
import suwayomi.tachidesk.manga.model.dataclass.ExtensionDataClass
|
import suwayomi.tachidesk.manga.model.dataclass.ExtensionDataClass
|
||||||
import suwayomi.tachidesk.server.applicationSetup
|
import suwayomi.tachidesk.server.applicationSetup
|
||||||
|
import xyz.nulldev.ts.config.CONFIG_PREFIX
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
|
|
||||||
@@ -48,8 +49,8 @@ class TestExtensions {
|
|||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
fun setup() {
|
fun setup() {
|
||||||
val dataRoot = File("tmp/TestDesk").absolutePath
|
val dataRoot = File(BASE_PATH).absolutePath
|
||||||
System.setProperty("suwayomi.tachidesk.server.rootDir", dataRoot)
|
System.setProperty("$CONFIG_PREFIX.server.rootDir", dataRoot)
|
||||||
applicationSetup()
|
applicationSetup()
|
||||||
setLoggingEnabled(false)
|
setLoggingEnabled(false)
|
||||||
|
|
||||||
@@ -72,7 +73,7 @@ class TestExtensions {
|
|||||||
sources = getSourceList().map { getCatalogueSource(it.id.toLong())!! as HttpSource }
|
sources = getSourceList().map { getCatalogueSource(it.id.toLong())!! as HttpSource }
|
||||||
}
|
}
|
||||||
setLoggingEnabled(true)
|
setLoggingEnabled(true)
|
||||||
File("tmp/TestDesk/sources.txt").writeText(sources.joinToString("\n") { "${it.name} - ${it.lang.uppercase()} - ${it.id}" })
|
File("$BASE_PATH/sources.txt").writeText(sources.joinToString("\n") { "${it.name} - ${it.lang.uppercase()} - ${it.id}" })
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -97,7 +98,7 @@ class TestExtensions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.awaitAll()
|
}.awaitAll()
|
||||||
File("tmp/TestDesk/failedToFetch.txt").writeText(
|
File("$BASE_PATH/failedToFetch.txt").writeText(
|
||||||
failedToFetch.joinToString("\n") { (source, exception) ->
|
failedToFetch.joinToString("\n") { (source, exception) ->
|
||||||
"${source.name} (${source.lang.uppercase()}, ${source.id}):" +
|
"${source.name} (${source.lang.uppercase()}, ${source.id}):" +
|
||||||
" ${exception.message}"
|
" ${exception.message}"
|
||||||
@@ -122,7 +123,7 @@ class TestExtensions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.awaitAll()
|
}.awaitAll()
|
||||||
File("tmp/TestDesk/MangaFailedToFetch.txt").writeText(
|
File("$BASE_PATH/MangaFailedToFetch.txt").writeText(
|
||||||
mangaFailedToFetch.joinToString("\n") { (source, manga, exception) ->
|
mangaFailedToFetch.joinToString("\n") { (source, manga, exception) ->
|
||||||
"${source.name} (${source.lang}, ${source.id}):" +
|
"${source.name} (${source.lang}, ${source.id}):" +
|
||||||
" ${manga.title} (${source.mangaDetailsRequest(manga).url}):" +
|
" ${manga.title} (${source.mangaDetailsRequest(manga).url}):" +
|
||||||
@@ -157,7 +158,7 @@ class TestExtensions {
|
|||||||
}
|
}
|
||||||
}.awaitAll()
|
}.awaitAll()
|
||||||
|
|
||||||
File("tmp/TestDesk/ChaptersFailedToFetch.txt").writeText(
|
File("$BASE_PATH/ChaptersFailedToFetch.txt").writeText(
|
||||||
chaptersFailedToFetch.joinToString("\n") { (source, manga, exception) ->
|
chaptersFailedToFetch.joinToString("\n") { (source, manga, exception) ->
|
||||||
"${source.name} (${source.lang}, ${source.id}):" +
|
"${source.name} (${source.lang}, ${source.id}):" +
|
||||||
" ${manga.title} (${source.mangaDetailsRequest(manga).url}):" +
|
" ${manga.title} (${source.mangaDetailsRequest(manga).url}):" +
|
||||||
@@ -182,7 +183,7 @@ class TestExtensions {
|
|||||||
}
|
}
|
||||||
}.awaitAll()
|
}.awaitAll()
|
||||||
|
|
||||||
File("tmp/TestDesk/ChapterPageListFailedToFetch.txt").writeText(
|
File("$BASE_PATH/ChapterPageListFailedToFetch.txt").writeText(
|
||||||
chaptersPageListFailedToFetch.joinToString("\n") { (source, manga, exception) ->
|
chaptersPageListFailedToFetch.joinToString("\n") { (source, manga, exception) ->
|
||||||
"${source.name} (${source.lang}, ${source.id}):" +
|
"${source.name} (${source.lang}, ${source.id}):" +
|
||||||
" ${manga.first.title} (${source.mangaDetailsRequest(manga.first).url}):" +
|
" ${manga.first.title} (${source.mangaDetailsRequest(manga.first).url}):" +
|
||||||
|
|||||||
@@ -17,3 +17,5 @@ fun setLoggingEnabled(enabled: Boolean = true) {
|
|||||||
Level.DEBUG
|
Level.DEBUG
|
||||||
} else Level.ERROR
|
} else Level.ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const val BASE_PATH = "build/tmp/TestDesk"
|
||||||
|
|||||||
Reference in New Issue
Block a user