TimelineRepositoryTest: fix

This commit is contained in:
Alibek Omarov 2020-01-16 18:26:31 +03:00
parent 9796da7513
commit f16799bf8f
1 changed files with 9 additions and 9 deletions

View File

@ -84,7 +84,7 @@ class TimelineRepositoryTest {
makeStatus("3"),
makeStatus("2")
)
whenever(mastodonApi.homeTimelineSingle(isNull(), isNull(), anyInt()))
whenever(mastodonApi.homeTimelineSingle(isNull(), isNull(), anyInt(), any()))
.thenReturn(Single.just(statuses))
val result = subject.getStatuses(null, null, null, limit, TimelineRequestMode.NETWORK)
.blockingGet()
@ -114,7 +114,7 @@ class TimelineRepositoryTest {
)
val sinceId = "2"
val sinceIdMinusOne = "1"
whenever(mastodonApi.homeTimelineSingle(null, sinceIdMinusOne, limit + 1))
whenever(mastodonApi.homeTimelineSingle(null, sinceIdMinusOne, limit + 1, true))
.thenReturn(Single.just(response))
val result = subject.getStatuses(null, sinceId, sinceIdMinusOne, limit,
TimelineRequestMode.NETWORK)
@ -147,7 +147,7 @@ class TimelineRepositoryTest {
)
val sinceId = "2"
val sinceIdMinusOne = "1"
whenever(mastodonApi.homeTimelineSingle(null, sinceIdMinusOne, limit + 1))
whenever(mastodonApi.homeTimelineSingle(null, sinceIdMinusOne, limit + 1, true))
.thenReturn(Single.just(response))
val result = subject.getStatuses(null, sinceId, sinceIdMinusOne, limit,
TimelineRequestMode.NETWORK)
@ -186,7 +186,7 @@ class TimelineRepositoryTest {
val sinceId = "2"
val sinceIdMinusOne = "1"
val maxId = "3"
whenever(mastodonApi.homeTimelineSingle(maxId, sinceIdMinusOne, limit + 1))
whenever(mastodonApi.homeTimelineSingle(maxId, sinceIdMinusOne, limit + 1, true))
.thenReturn(Single.just(response))
val result = subject.getStatuses(maxId, sinceId, sinceIdMinusOne, limit,
TimelineRequestMode.NETWORK)
@ -228,7 +228,7 @@ class TimelineRepositoryTest {
val sinceId = "2"
val sinceIdMinusOne = "1"
val maxId = "4"
whenever(mastodonApi.homeTimelineSingle(maxId, sinceIdMinusOne, limit + 1))
whenever(mastodonApi.homeTimelineSingle(maxId, sinceIdMinusOne, limit + 1, true))
.thenReturn(Single.just(response))
val result = subject.getStatuses(maxId, sinceId, sinceIdMinusOne, limit,
TimelineRequestMode.NETWORK)
@ -266,10 +266,10 @@ class TimelineRepositoryTest {
dbResult.status = dbStatus.toEntity(account.id, htmlConverter, gson)
dbResult.account = status.account.toEntity(account.id, gson)
whenever(mastodonApi.homeTimelineSingle(any(), any(), any()))
whenever(mastodonApi.homeTimelineSingle(any(), any(), any(), any()))
.thenReturn(Single.just(listOf(status)))
whenever(timelineDao.getStatusesForAccount(account.id, status.id, null, 30))
.thenReturn(Single.just(listOf(dbResult)))
.thenReturn(Single.just(listOf(dbResult)))
val result = subject.getStatuses(null, null, null, limit, TimelineRequestMode.ANY)
.blockingGet()
assertEquals(listOf(status, dbStatus).map(Status::lift), result)
@ -284,7 +284,7 @@ class TimelineRepositoryTest {
val dbResult2 = TimelineStatusWithAccount()
dbResult2.status = Placeholder("1").toEntity(account.id)
whenever(mastodonApi.homeTimelineSingle(any(), any(), any()))
whenever(mastodonApi.homeTimelineSingle(any(), any(), any(), any()))
.thenReturn(Single.just(listOf(status)))
whenever(timelineDao.getStatusesForAccount(account.id, status.id, null, 30))
.thenReturn(Single.just(listOf(dbResult, dbResult2)))
@ -340,4 +340,4 @@ class TimelineRepositoryTest {
source = null
)
}
}
}