Skip to content

Commit

Permalink
Fix broken unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Horta committed Dec 8, 2023
1 parent 6d8ca46 commit de66db5
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class FeaturedImageHelperTest {
// Act
val mediaModel = featuredImageHelper.retryFeaturedImageUpload(mock(), mock())
// Assert
verify(uploadServiceFacade).uploadMedia(argThat { this[0] == mediaModel })
verify(uploadServiceFacade).uploadMedia(argThat { this[0] == mediaModel }, any())
}

@Test
Expand Down Expand Up @@ -189,7 +189,7 @@ class FeaturedImageHelperTest {
// Act
featuredImageHelper.queueFeaturedImageForUpload(0, createSiteModel(), mock(), "")
// Assert
verify(uploadServiceFacade).uploadMedia(argThat { this[0] == mediaModel })
verify(uploadServiceFacade).uploadMedia(argThat { this[0] == mediaModel }, any())
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.junit.Before
import org.junit.Test
import org.mockito.Mock
import org.mockito.kotlin.any
import org.mockito.kotlin.eq
import org.mockito.kotlin.verify
import org.mockito.kotlin.verifyNoInteractions
import org.mockito.kotlin.whenever
Expand Down Expand Up @@ -249,7 +250,7 @@ class StorePostViewModelTest : BaseUnitTest() {
verify(savePostToDbUseCase).savePostToDb(postRepository, site)
assertThat(result).isEqualTo(SAVED_ONLINE)
verify(postUtils).trackSavePostAnalytics(postModel, site)
verify(uploadService).uploadPost(context, postId, isFirstTimePublish)
verify(uploadService).uploadPost(eq(context), eq(postId), eq(isFirstTimePublish), any())
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class UploadStarterConcurrentTest : BaseUnitTest() {
verify(uploadServiceFacade, times(draftPosts.size)).uploadPost(
context = any(),
post = any(),
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any()
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class UploadStarterMutexTest : BaseUnitTest() {
.thenReturn(UploadActionUseCase.UploadAction.UPLOAD)

// throw IllegalStateException when uploading post (emulate trying to start background service)
whenever(uploadServiceFacade.uploadPost(any(), any<PostModel>(), any()))
whenever(uploadServiceFacade.uploadPost(any(), any<PostModel>(), any(), any()))
.thenThrow(IllegalStateException("FAKE: Not allowed to start service intent"))

// ACT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ class UploadStarterTest : BaseUnitTest() {
verify(uploadServiceFacade, times(draftPosts.size + draftPages.size)).uploadPost(
context = any(),
post = any(),
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any(),
)
}

Expand All @@ -166,7 +167,8 @@ class UploadStarterTest : BaseUnitTest() {
verify(uploadServiceFacade, times(0)).uploadPost(
context = any(),
post = any(),
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any(),
)
}

Expand All @@ -188,7 +190,8 @@ class UploadStarterTest : BaseUnitTest() {
verify(uploadServiceFacade, times(draftPosts.size + draftPages.size)).uploadPost(
context = any(),
post = any(),
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any(),
)
}

Expand All @@ -211,7 +214,8 @@ class UploadStarterTest : BaseUnitTest() {
verify(uploadServiceFacade, times(expectedUploadPostExecutions)).uploadPost(
context = any(),
post = any(),
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any(),
)
}

Expand Down Expand Up @@ -241,7 +245,8 @@ class UploadStarterTest : BaseUnitTest() {
verify(uploadServiceFacade, times(expectedUploadPostExecutions)).uploadPost(
context = any(),
post = any(),
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any(),
)
}

Expand Down Expand Up @@ -283,7 +288,8 @@ class UploadStarterTest : BaseUnitTest() {
verify(uploadServiceFacade, times(expectedUploadPostsAndPages.size)).uploadPost(
context = any(),
post = argWhere { expectedUploadPostsAndPages.contains(it) },
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any(),
)
verify(
uploadServiceFacade,
Expand Down Expand Up @@ -315,7 +321,8 @@ class UploadStarterTest : BaseUnitTest() {
verify(uploadServiceFacade, never()).uploadPost(
context = any(),
post = any(),
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any(),
)
}

Expand All @@ -333,7 +340,8 @@ class UploadStarterTest : BaseUnitTest() {
verify(uploadServiceFacade, never()).uploadPost(
context = any(),
post = any(),
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any(),
)
}

Expand All @@ -351,7 +359,8 @@ class UploadStarterTest : BaseUnitTest() {
verify(uploadServiceFacade, times(1)).uploadPost(
context = any(),
post = any(),
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any(),
)
}

Expand All @@ -373,7 +382,8 @@ class UploadStarterTest : BaseUnitTest() {
verify(uploadServiceFacade, never()).uploadPost(
context = any(),
post = any(),
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any(),
)
}

Expand All @@ -395,7 +405,8 @@ class UploadStarterTest : BaseUnitTest() {
verify(uploadServiceFacade, times(1)).uploadPost(
context = any(),
post = any(),
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any(),
)
}

Expand All @@ -416,7 +427,8 @@ class UploadStarterTest : BaseUnitTest() {
verify(uploadServiceFacade, never()).uploadPost(
context = any(),
post = any(),
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any(),
)
}

Expand All @@ -436,7 +448,8 @@ class UploadStarterTest : BaseUnitTest() {
verify(uploadServiceFacade, never()).uploadPost(
context = any(),
post = any(),
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any(),
)
}

Expand All @@ -463,7 +476,8 @@ class UploadStarterTest : BaseUnitTest() {
verify(uploadServiceFacade, never()).uploadPost(
context = any(),
post = any(),
trackAnalytics = any()
trackAnalytics = any(),
sourceForLogging = any(),
)
}

Expand Down

0 comments on commit de66db5

Please sign in to comment.