mirror of
https://github.com/gotson/komga.git
synced 2026-05-09 05:10:19 +02:00
parent
eb10a12013
commit
25677967db
2 changed files with 21 additions and 2 deletions
|
|
@ -76,10 +76,13 @@ class ComicInfoProvider(
|
||||||
}
|
}
|
||||||
|
|
||||||
val genres = comicInfo.genre?.split(',')?.mapNotNull { it.trim().ifBlank { null } }
|
val genres = comicInfo.genre?.split(',')?.mapNotNull { it.trim().ifBlank { null } }
|
||||||
|
val series = comicInfo.series?.ifBlank { null }?.let { series ->
|
||||||
|
series + (comicInfo.volume?.let { " ($it)" } ?: "")
|
||||||
|
}
|
||||||
|
|
||||||
return SeriesMetadataPatch(
|
return SeriesMetadataPatch(
|
||||||
title = comicInfo.series?.ifBlank { null },
|
title = series,
|
||||||
titleSort = comicInfo.series?.ifBlank { null },
|
titleSort = series,
|
||||||
status = null,
|
status = null,
|
||||||
summary = null,
|
summary = null,
|
||||||
readingDirection = readingDirection,
|
readingDirection = readingDirection,
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,22 @@ class ComicInfoProviderTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `given comicInfo with volume when getting series metadata then metadata patch is valid`() {
|
||||||
|
val comicInfo = ComicInfo().apply {
|
||||||
|
series = "series"
|
||||||
|
volume = 2020
|
||||||
|
}
|
||||||
|
|
||||||
|
every { mockMapper.readValue(any<ByteArray>(), ComicInfo::class.java) } returns comicInfo
|
||||||
|
|
||||||
|
val patch = comicInfoProvider.getSeriesMetadataFromBook(book, media)!!
|
||||||
|
|
||||||
|
with(patch) {
|
||||||
|
assertThat(title).isEqualTo("series (2020)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `given comicInfo with incorrect values when getting series metadata then metadata patch is valid`() {
|
fun `given comicInfo with incorrect values when getting series metadata then metadata patch is valid`() {
|
||||||
val comicInfo = ComicInfo().apply {
|
val comicInfo = ComicInfo().apply {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue