Fixes to season/episode search with duplicates (#1946)
## Description Fixes cases where the server has duplicate season IDs causing the season index search to fail and default to the first season in the list. ### Related issues Fixes #1837 ### Testing Emulator & unit tests ## Screenshots N/A ## AI or LLM usage None
This commit is contained in:
parent
1778bdb34c
commit
4a567cbcf4
3 changed files with 108 additions and 35 deletions
|
|
@ -156,7 +156,12 @@ class TestFindIndexByNumberOrId {
|
|||
fun `Test with special matching number`() =
|
||||
runTest {
|
||||
val list = listOf(epS02E01, epS00E02, epS02E02)
|
||||
findIndexByNumberOrId(targetNum = 2, targetId = epS02E02.id, list = BlockingList.of(list)).let { index ->
|
||||
findIndexByNumberOrId(
|
||||
targetNum = 2,
|
||||
targetId = epS02E02.id,
|
||||
list = BlockingList.of(list),
|
||||
parentIndex = 2,
|
||||
).let { index ->
|
||||
Assert.assertEquals(2, index)
|
||||
}
|
||||
}
|
||||
|
|
@ -195,4 +200,23 @@ class TestFindIndexByNumberOrId {
|
|||
Assert.assertEquals(4, index)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Test with non-matching parent ID`() =
|
||||
runTest {
|
||||
val altSeason2Id = UUID.randomUUID()
|
||||
Assert.assertNotEquals(altSeason2Id, season2Id)
|
||||
Assert.assertNotEquals(altSeason2Id, epS02E02.data.parentId)
|
||||
|
||||
val list = listOf(epS02E01, epS02E02)
|
||||
findIndexByNumberOrId(
|
||||
targetNum = 2,
|
||||
targetId = epS02E02.id,
|
||||
list = BlockingList.of(list),
|
||||
parentId = altSeason2Id,
|
||||
parentIndex = 2,
|
||||
).let { index ->
|
||||
Assert.assertEquals(1, index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue