simplify timeline cleanup (#1932)

* simplify timeline cleanup

* fix test
This commit is contained in:
Konrad Pozniak 2020-09-14 07:52:54 +02:00 committed by GitHub
commit a6673a6eb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 35 deletions

View file

@ -1,10 +1,8 @@
package com.keylesspalace.tusky.fragment
import android.text.SpannableString
import android.text.SpannedString
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.gson.Gson
import com.keylesspalace.tusky.SpanUtilsTest
import com.keylesspalace.tusky.db.AccountEntity
import com.keylesspalace.tusky.db.AccountManager
import com.keylesspalace.tusky.db.TimelineDao
@ -26,8 +24,7 @@ import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers.any
import org.mockito.ArgumentMatchers.anyInt
import org.mockito.ArgumentMatchers.*
import org.mockito.Mock
import org.mockito.MockitoAnnotations
import org.robolectric.annotation.Config
@ -97,6 +94,7 @@ class TimelineRepositoryTest {
null
)
}
verify(timelineDao).cleanup(anyLong())
verifyNoMoreInteractions(timelineDao)
}
@ -131,6 +129,7 @@ class TimelineRepositoryTest {
}
verify(timelineDao).removeAllPlaceholdersBetween(account.id, response.first().id,
response.last().id)
verify(timelineDao).cleanup(anyLong())
verifyNoMoreInteractions(timelineDao)
}
@ -160,6 +159,7 @@ class TimelineRepositoryTest {
)
}
verify(timelineDao).insertStatusIfNotThere(placeholder.toEntity(account.id))
verify(timelineDao).cleanup(anyLong())
verifyNoMoreInteractions(timelineDao)
}
@ -203,6 +203,7 @@ class TimelineRepositoryTest {
}
verify(timelineDao).removeAllPlaceholdersBetween(account.id, response.first().id,
response.last().id)
verify(timelineDao).cleanup(anyLong())
verifyNoMoreInteractions(timelineDao)
}
@ -249,6 +250,7 @@ class TimelineRepositoryTest {
verify(timelineDao).removeAllPlaceholdersBetween(account.id, response.first().id,
response.last().id)
verify(timelineDao).insertStatusIfNotThere(placeholder.toEntity(account.id))
verify(timelineDao).cleanup(anyLong())
verifyNoMoreInteractions(timelineDao)
}