mirror of
https://github.com/gotson/komga.git
synced 2026-05-08 12:35:30 +02: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 genres = comicInfo.genre?.split(',')?.mapNotNull { it.trim().ifBlank { null } }
|
||||||
val series = comicInfo.series?.ifBlank { null }?.let { series ->
|
val series = comicInfo.series?.ifBlank { null }?.let { series ->
|
||||||
series + (comicInfo.volume?.let { " ($it)" } ?: "")
|
series + (comicInfo.volume?.let { if (it != 1) " ($it)" else "" } ?: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
return SeriesMetadataPatch(
|
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
|
@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