mirror of
https://github.com/gotson/komga.git
synced 2025-12-21 16:03:03 +01: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 series = comicInfo.series?.ifBlank { null }?.let { series ->
|
||||
series + (comicInfo.volume?.let { " ($it)" } ?: "")
|
||||
}
|
||||
|
||||
return SeriesMetadataPatch(
|
||||
title = comicInfo.series?.ifBlank { null },
|
||||
titleSort = comicInfo.series?.ifBlank { null },
|
||||
title = series,
|
||||
titleSort = series,
|
||||
status = null,
|
||||
summary = null,
|
||||
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
|
||||
fun `given comicInfo with incorrect values when getting series metadata then metadata patch is valid`() {
|
||||
val comicInfo = ComicInfo().apply {
|
||||
|
|
|
|||
Loading…
Reference in a new issue