Skip to content

Commit

Permalink
Fix getting sinceId after last items call in FeverDataSource
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinokuni committed Aug 14, 2024
1 parent 7b39203 commit dd98c7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class FeverDataSource(private val service: FeverService) {
}

sinceId = if (items.isNotEmpty()) {
items.first().remoteId!!.toLong()
items.maxOfOrNull { it.remoteId!!.toLong() }!!
} else {
localSinceId.toLong()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class FeverDataSourceTest : KoinTest {
assertEquals(6, result.starredIds.size)
assertEquals(10, result.items.size)
assertEquals(10, result.items.size)
assertEquals(1564058340320135, result.sinceId)

assertEquals("1564058340320135", firstMaxId)
assertEquals("6", secondMaxId)
Expand Down Expand Up @@ -229,6 +230,7 @@ class FeverDataSourceTest : KoinTest {
assertEquals(6, result.unreadIds.size)
assertEquals(6, result.starredIds.size)
assertEquals(10, result.items.size)
assertEquals(10, result.sinceId)

assertEquals("1", firstLastSinceId)
assertEquals("5", secondLastSinceId)
Expand Down

0 comments on commit dd98c7b

Please sign in to comment.