mirror of
https://github.com/accelforce/Yuito
synced 2024-12-21 12:34:51 +01:00
Fix tests
This commit is contained in:
parent
9899b99e1e
commit
83025f93c3
@ -1,6 +1,8 @@
|
||||
package com.keylesspalace.tusky.components.timeline
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.net.ConnectivityManager
|
||||
import com.google.gson.Gson
|
||||
import com.keylesspalace.tusky.appstore.EventHub
|
||||
import com.keylesspalace.tusky.components.timeline.TimelineViewModel.Companion.LOAD_AT_ONCE
|
||||
import com.keylesspalace.tusky.db.AccountEntity
|
||||
@ -14,24 +16,15 @@ import com.keylesspalace.tusky.network.TimelineCases
|
||||
import com.keylesspalace.tusky.util.Either
|
||||
import com.keylesspalace.tusky.util.toViewData
|
||||
import com.keylesspalace.tusky.viewdata.StatusViewData
|
||||
import com.nhaarman.mockitokotlin2.clearInvocations
|
||||
import com.nhaarman.mockitokotlin2.doReturn
|
||||
import com.nhaarman.mockitokotlin2.eq
|
||||
import com.nhaarman.mockitokotlin2.isNull
|
||||
import com.nhaarman.mockitokotlin2.mock
|
||||
import com.nhaarman.mockitokotlin2.times
|
||||
import com.nhaarman.mockitokotlin2.verify
|
||||
import com.nhaarman.mockitokotlin2.whenever
|
||||
import com.nhaarman.mockitokotlin2.*
|
||||
import io.reactivex.rxjava3.annotations.NonNull
|
||||
import io.reactivex.rxjava3.core.Observable
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import io.reactivex.rxjava3.observers.TestObserver
|
||||
import io.reactivex.rxjava3.subjects.PublishSubject
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import okhttp3.OkHttpClient
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.robolectric.annotation.Config
|
||||
@ -48,6 +41,9 @@ class TimelineViewModelTest {
|
||||
lateinit var viewModel: TimelineViewModel
|
||||
lateinit var accountManager: AccountManager
|
||||
lateinit var sharedPreference: SharedPreferences
|
||||
lateinit var connectivityManager: ConnectivityManager
|
||||
lateinit var okHttpClient: OkHttpClient
|
||||
lateinit var gson: Gson
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
@ -69,6 +65,9 @@ class TimelineViewModelTest {
|
||||
on { activeAccount } doReturn account
|
||||
}
|
||||
sharedPreference = mock()
|
||||
connectivityManager = mock()
|
||||
okHttpClient = mock()
|
||||
gson = mock()
|
||||
viewModel = TimelineViewModel(
|
||||
timelineRepository,
|
||||
timelineCases,
|
||||
@ -76,7 +75,10 @@ class TimelineViewModelTest {
|
||||
eventHub,
|
||||
accountManager,
|
||||
sharedPreference,
|
||||
FilterModel()
|
||||
FilterModel(),
|
||||
connectivityManager,
|
||||
okHttpClient,
|
||||
gson,
|
||||
)
|
||||
}
|
||||
|
||||
@ -152,7 +154,7 @@ class TimelineViewModelTest {
|
||||
@Test
|
||||
fun `loadInitial, list`() {
|
||||
val listId = "listId"
|
||||
viewModel.init(TimelineViewModel.Kind.LIST, listId, listOf())
|
||||
viewModel.init(TimelineViewModel.Kind.LIST, listId, listOf(), false)
|
||||
val status = makeStatus("1")
|
||||
|
||||
whenever(
|
||||
|
Loading…
Reference in New Issue
Block a user