mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
[fenix] Fix intermittent test failures in PagedHistoryProviderTest
This commit is contained in:
parent
bcf051b559
commit
696561599e
@ -7,10 +7,10 @@ package org.mozilla.fenix.components.history
|
||||
import io.mockk.coEvery
|
||||
import io.mockk.coVerify
|
||||
import io.mockk.mockk
|
||||
import io.mockk.verify
|
||||
import mozilla.components.concept.storage.HistoryStorage
|
||||
import mozilla.components.concept.storage.VisitInfo
|
||||
import mozilla.components.concept.storage.VisitType
|
||||
import org.junit.Assert.assertSame
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
@ -27,11 +27,12 @@ class PagedHistoryProviderTest {
|
||||
fun `getHistory uses getVisitsPaginated`() {
|
||||
val provider = storage.createSynchronousPagedHistoryProvider()
|
||||
val results = listOf<VisitInfo>(mockk(), mockk())
|
||||
val onComplete = mockk<(List<VisitInfo>) -> Unit>(relaxed = true)
|
||||
|
||||
coEvery { storage.getVisitsPaginated(any(), any(), any()) } returns results
|
||||
|
||||
provider.getHistory(10L, 5, onComplete)
|
||||
var actualResults: List<VisitInfo>? = null
|
||||
provider.getHistory(10L, 5) {
|
||||
actualResults = it
|
||||
}
|
||||
|
||||
coVerify {
|
||||
storage.getVisitsPaginated(
|
||||
@ -48,6 +49,7 @@ class PagedHistoryProviderTest {
|
||||
)
|
||||
)
|
||||
}
|
||||
verify { onComplete(results) }
|
||||
|
||||
assertSame(results, actualResults)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user