Skip to content

Commit

Permalink
Fixes broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonis Lilis committed Dec 7, 2020
1 parent f5ab73b commit f0147aa
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.wordpress.android.ui.posts

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.mock
Expand All @@ -23,11 +24,16 @@ import org.wordpress.android.fluxc.network.xmlrpc.post.PostXMLRPCClient
import org.wordpress.android.fluxc.persistence.PostSqlUtils
import org.wordpress.android.fluxc.store.PostStore
import org.wordpress.android.ui.posts.PostListAction.EditPost
import org.wordpress.android.ui.posts.PostListViewLayoutType.STANDARD
import org.wordpress.android.ui.prefs.AppPrefsWrapper
import org.wordpress.android.viewmodel.Event

class PostListMainViewModelCopyPostTest : BaseUnitTest() {
@Mock lateinit var site: SiteModel
@Mock lateinit var dispatcher: Dispatcher
@Mock lateinit var postSqlUtils: PostSqlUtils
@Mock lateinit var editPostRepository: EditPostRepository
@Mock lateinit var prefs: AppPrefsWrapper
@Mock lateinit var onPostListActionObserver: Observer<PostListAction>

private lateinit var viewModel: PostListMainViewModel
Expand Down Expand Up @@ -58,7 +64,7 @@ class PostListMainViewModelCopyPostTest : BaseUnitTest() {
uploadStore = mock(),
mediaStore = mock(),
networkUtilsWrapper = mock(),
prefs = mock(),
prefs = prefs,
previewStateHelper = mock(),
analyticsTracker = mock(),
mainDispatcher = Dispatchers.Unconfined,
Expand All @@ -74,6 +80,10 @@ class PostListMainViewModelCopyPostTest : BaseUnitTest() {
whenever(postSqlUtils.insertPostForResult(any())).thenAnswer { invocation ->
(invocation.arguments[0] as PostModel).apply { setId(copyPostId) }
}
whenever(editPostRepository.postChanged).thenReturn(MutableLiveData(Event(PostModel())))
whenever(prefs.postListViewLayoutType).thenReturn(STANDARD)

viewModel.start(site, mock(), mock(), editPostRepository, mock())
}

@Test
Expand Down

0 comments on commit f0147aa

Please sign in to comment.