mirror of
https://github.com/gotson/komga.git
synced 2025-12-21 16:03:03 +01:00
parent
ef780c31d6
commit
1cb9ae6aad
2 changed files with 17 additions and 1 deletions
|
|
@ -77,7 +77,7 @@ 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)" } ?: "")
|
||||
series + (comicInfo.volume?.let { if (it != 1) " ($it)" else "" } ?: "")
|
||||
}
|
||||
|
||||
return SeriesMetadataPatch(
|
||||
|
|
|
|||
|
|
@ -229,6 +229,22 @@ class ComicInfoProviderTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `given comicInfo with volume as 1 when getting series metadata then metadata title omits volume`() {
|
||||
val comicInfo = ComicInfo().apply {
|
||||
series = "series"
|
||||
volume = 1
|
||||
}
|
||||
|
||||
every { mockMapper.readValue(any<ByteArray>(), ComicInfo::class.java) } returns comicInfo
|
||||
|
||||
val patch = comicInfoProvider.getSeriesMetadataFromBook(book, media)!!
|
||||
|
||||
with(patch) {
|
||||
assertThat(title).isEqualTo("series")
|
||||
}
|
||||
}
|
||||
|
||||
@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