Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): [WPB-9777] bump mockk from 1.13.10 to 1.13.16 #3751

Merged
merged 13 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import com.wire.kalium.logic.feature.server.StoreServerConfigResult
import com.wire.kalium.logic.functional.Either
import com.wire.kalium.logic.functional.isLeft
import com.wire.kalium.logic.functional.isRight
import io.mockk.Called
import io.mockk.MockKAnnotations
import io.mockk.coEvery
import io.mockk.coVerify
Expand Down Expand Up @@ -99,7 +98,7 @@ class MigrateServerConfigUseCaseTest {
.withScalaServerConfig(ScalaServerConfig.NoData)
.arrange()
val result = useCase()
coVerify { arrangement.globalKaliumScope.storeServerConfig(any(), any()) wasNot Called }
coVerify(exactly = 0) { arrangement.globalKaliumScope.storeServerConfig(any(), any()) }
assert(result.isLeft())
assertEquals(StorageFailure.DataNotFound, (result as Either.Left).value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import com.wire.kalium.logic.feature.connection.UnblockUserUseCase
import com.wire.kalium.logic.feature.conversation.CreateConversationResult
import com.wire.kalium.logic.feature.conversation.GetOrCreateOneToOneConversationUseCase
import com.wire.kalium.logic.feature.user.ObserveSelfUserUseCase
import io.mockk.Called
import io.mockk.MockKAnnotations
import io.mockk.coEvery
import io.mockk.coVerify
Expand Down Expand Up @@ -273,7 +272,7 @@ class ConnectionActionButtonViewModelTest {
arrangement.getOrCreateOneToOneConversation(TestUser.USER_ID)
}
verify { arrangement.onOpenConversation(any()) }
verify { arrangement.onMissingKeyPackages wasNot Called }
verify(exactly = 0) { arrangement.onMissingKeyPackages.invoke() }
assertEquals(false, viewModel.actionableState().isPerformingAction)
}

Expand All @@ -292,8 +291,8 @@ class ConnectionActionButtonViewModelTest {
coVerify {
arrangement.getOrCreateOneToOneConversation(TestUser.USER_ID)
}
verify { arrangement.onOpenConversation wasNot Called }
verify { arrangement.onMissingKeyPackages wasNot Called }
verify(exactly = 0) { arrangement.onOpenConversation.invoke(any()) }
verify(exactly = 0) { arrangement.onMissingKeyPackages() }
assertEquals(false, viewModel.actionableState().isPerformingAction)
}

Expand All @@ -312,7 +311,7 @@ class ConnectionActionButtonViewModelTest {
coVerify {
arrangement.getOrCreateOneToOneConversation(TestUser.USER_ID)
}
verify { arrangement.onOpenConversation wasNot Called }
verify(exactly = 0) { arrangement.onOpenConversation.invoke(any()) }
verify { arrangement.onMissingKeyPackages() }
assertEquals(false, viewModel.actionableState().isPerformingAction)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import com.wire.kalium.logic.feature.session.GetAllSessionsResult
import com.wire.kalium.logic.feature.session.GetSessionsUseCase
import com.wire.kalium.logic.feature.user.GetSelfUserUseCase
import com.wire.kalium.logic.feature.user.IsPasswordRequiredUseCase
import io.mockk.Called
import io.mockk.MockKAnnotations
import io.mockk.coEvery
import io.mockk.coVerify
Expand Down Expand Up @@ -77,7 +76,7 @@ class ForgotLockScreenViewModelTest {
val (result, resultPassword) = viewModel.validatePasswordIfNeeded("password")
assert(result is ForgotLockScreenViewModel.Result.Success)
assertEquals("", resultPassword)
verify { arrangement.validatePasswordUseCase(any()) wasNot Called }
verify(exactly = 0) { arrangement.validatePasswordUseCase(any()) }
}
@Test
fun `given password required and valid, when validating password, then return Success with given password`() =
Expand Down Expand Up @@ -118,7 +117,7 @@ class ForgotLockScreenViewModelTest {
.arrange()
val (result, _) = viewModel.validatePasswordIfNeeded("password")
assert(result is ForgotLockScreenViewModel.Result.Failure)
verify { arrangement.validatePasswordUseCase(any()) wasNot Called }
verify(exactly = 0) { arrangement.validatePasswordUseCase(any()) }
}

// current client deletion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import com.wire.kalium.logic.feature.conversation.ObserveOtherUserSecurityClassi
import com.wire.kalium.logic.feature.conversation.ObserveSecurityClassificationLabelUseCase
import com.wire.kalium.logic.feature.conversation.SecurityClassificationType
import io.mockk.MockKAnnotations
import io.mockk.called
import io.mockk.coEvery
import io.mockk.coVerify
import io.mockk.every
Expand Down Expand Up @@ -64,8 +63,8 @@ class SecurityClassificationViewModelTest {
// Then
assertEquals(SecurityClassificationType.CLASSIFIED, viewModel.state())

coVerify {
arrangement.getOtherUserSecurityClassificationLabel(any()) wasNot called
coVerify(exactly = 0) {
arrangement.getOtherUserSecurityClassificationLabel(any())
}
}

Expand All @@ -85,8 +84,8 @@ class SecurityClassificationViewModelTest {
// Then
assertEquals(SecurityClassificationType.CLASSIFIED, viewModel.state())

coVerify {
arrangement.observeSecurityClassificationLabel(any()) wasNot called
coVerify(exactly = 0) {
arrangement.observeSecurityClassificationLabel(any())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,20 @@ import com.wire.android.util.newServerConfig
import com.wire.kalium.logic.StorageFailure
import com.wire.kalium.logic.data.id.TeamId
import com.wire.kalium.logic.feature.team.GetUpdatedSelfTeamUseCase
import com.wire.kalium.logic.feature.user.ObserveSelfUserUseCase
import com.wire.kalium.logic.feature.user.IsE2EIEnabledUseCase
import com.wire.kalium.logic.feature.user.IsPasswordRequiredUseCase
import com.wire.kalium.logic.feature.user.IsPasswordRequiredUseCase.Result.Success
import com.wire.kalium.logic.feature.user.IsReadOnlyAccountUseCase
import com.wire.kalium.logic.feature.user.IsSelfATeamMemberUseCase
import com.wire.kalium.logic.feature.user.ObserveSelfUserUseCase
import com.wire.kalium.logic.feature.user.SelfServerConfigUseCase
import com.wire.kalium.logic.functional.Either
import io.mockk.Called
import io.mockk.MockKAnnotations
import io.mockk.coEvery
import io.mockk.coVerify
import io.mockk.every
import io.mockk.impl.annotations.MockK
import io.mockk.mockkObject
import io.mockk.verify
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.runTest
Expand Down Expand Up @@ -118,8 +116,8 @@ class MyAccountViewModelTest {
.withE2EIEnabledResult(false)
.arrange()

verify {
arrangement.selfServerConfigUseCase wasNot Called
coVerify(exactly = 0) {
arrangement.selfServerConfigUseCase.invoke()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import com.wire.kalium.logic.feature.auth.ValidateUserHandleUseCase
import com.wire.kalium.logic.feature.user.GetSelfUserUseCase
import com.wire.kalium.logic.feature.user.SetUserHandleResult
import com.wire.kalium.logic.feature.user.SetUserHandleUseCase
import io.mockk.Called
import io.mockk.MockKAnnotations
import io.mockk.coEvery
import io.mockk.coVerify
Expand Down Expand Up @@ -84,8 +83,8 @@ class ChangeHandleViewModelTest {
viewModel.onSaveClicked(arrangement.onSuccess)

assertEquals(viewModel.state.error, HandleUpdateErrorState.TextFieldError.UsernameInvalidError)
coVerify {
arrangement.validateHandle("handle") wasNot Called
coVerify(exactly = 1) {
arrangement.validateHandle("handle")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import com.wire.kalium.logic.feature.legalhold.ApproveLegalHoldRequestUseCase
import com.wire.kalium.logic.feature.legalhold.ObserveLegalHoldRequestUseCase
import com.wire.kalium.logic.feature.session.CurrentSessionResult
import com.wire.kalium.logic.feature.user.IsPasswordRequiredUseCase
import io.mockk.Called
import io.mockk.MockKAnnotations
import io.mockk.coEvery
import io.mockk.coVerify
Expand Down Expand Up @@ -248,7 +247,7 @@ class LegalHoldRequestedViewModelTest {
.arrange()
advanceUntilIdle()
viewModel.acceptClicked()
verify { arrangement.validatePassword(any()) wasNot Called }
verify(exactly = 0) { arrangement.validatePassword(any()) }
coVerify { arrangement.userSessionScope.approveLegalHoldRequest(matchNullable { it == null }) }
}

Expand All @@ -263,7 +262,7 @@ class LegalHoldRequestedViewModelTest {
advanceUntilIdle()
viewModel.acceptClicked()
verify { arrangement.validatePassword(password) }
coVerify { arrangement.userSessionScope.approveLegalHoldRequest(matchNullable { it.isNullOrEmpty() }) wasNot Called }
coVerify(exactly = 0) { arrangement.userSessionScope.approveLegalHoldRequest(matchNullable { it.isNullOrEmpty() }) }
}

@Test
Expand All @@ -276,7 +275,7 @@ class LegalHoldRequestedViewModelTest {
viewModel.passwordTextState.setTextAndPlaceCursorAtEnd(password)
advanceUntilIdle()
viewModel.acceptClicked()
coVerify { arrangement.userSessionScope.approveLegalHoldRequest(password) wasNot Called }
coVerify(exactly = 0) { arrangement.userSessionScope.approveLegalHoldRequest(password) }
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import com.wire.kalium.logic.feature.user.IsPasswordRequiredUseCase
import com.wire.kalium.logic.feature.user.ObserveUserInfoUseCase
import com.wire.kalium.logic.functional.Either
import com.wire.kalium.logic.functional.right
import io.mockk.Called
import io.mockk.MockKAnnotations
import io.mockk.coEvery
import io.mockk.coVerify
Expand Down Expand Up @@ -132,10 +131,10 @@ class DeviceDetailsViewModelTest {

viewModel.removeDevice(arrangement.onSuccess)

coVerify {
arrangement.deleteClientUseCase(any()) wasNot Called
coVerify(exactly = 0) {
arrangement.deleteClientUseCase(any())
}
verify { arrangement.onSuccess wasNot Called }
verify(exactly = 0) { arrangement.onSuccess.invoke() }
assertIs<RemoveDeviceDialogState.Visible>(viewModel.state.removeDeviceDialogState)
assertIs<RemoveDeviceError.None>(viewModel.state.error)
}
Expand All @@ -151,10 +150,10 @@ class DeviceDetailsViewModelTest {

viewModel.onDialogDismissed()

coVerify {
arrangement.deleteClientUseCase(any()) wasNot Called
coVerify(exactly = 0) {
arrangement.deleteClientUseCase(any())
}
verify { arrangement.onSuccess wasNot Called }
verify(exactly = 0) { arrangement.onSuccess.invoke() }
assertIs<RemoveDeviceDialogState.Hidden>(viewModel.state.removeDeviceDialogState)
assertIs<RemoveDeviceError.None>(viewModel.state.error)
}
Expand All @@ -172,10 +171,10 @@ class DeviceDetailsViewModelTest {
viewModel.removeDevice(arrangement.onSuccess)
viewModel.clearDeleteClientError()

coVerify {
arrangement.deleteClientUseCase.invoke(any()) wasNot Called
coVerify(exactly = 0) {
arrangement.deleteClientUseCase.invoke(any())
}
verify { arrangement.onSuccess wasNot Called }
verify(exactly = 0) { arrangement.onSuccess.invoke() }
assertIs<RemoveDeviceDialogState.Visible>(viewModel.state.removeDeviceDialogState)
assertIs<RemoveDeviceError.None>(viewModel.state.error)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import com.wire.kalium.logic.feature.asset.GetAvatarAssetUseCase
import com.wire.kalium.logic.feature.asset.PublicAssetResult
import com.wire.kalium.logic.feature.user.UploadAvatarResult
import com.wire.kalium.logic.feature.user.UploadUserAvatarUseCase
import io.mockk.Called
import io.mockk.MockKAnnotations
import io.mockk.coEvery
import io.mockk.coVerify
Expand Down Expand Up @@ -104,7 +103,9 @@ class AvatarPickerViewModelTest {
with(arrangement) {
coVerify {
uploadUserAvatarUseCase(any(), any())
avatarImageManager.getWritableAvatarUri(any()) wasNot Called
}
coVerify(exactly = 1) {
avatarImageManager.getWritableAvatarUri(any())
}
verify(exactly = 0) { onSuccess(any()) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import com.wire.kalium.logic.feature.connection.BlockUserResult
import com.wire.kalium.logic.feature.conversation.GetOneToOneConversationUseCase
import com.wire.kalium.logic.feature.conversation.UpdateConversationMemberRoleResult
import com.wire.kalium.logic.feature.user.GetUserInfoResult
import io.mockk.Called
import io.mockk.coVerify
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
Expand Down Expand Up @@ -87,8 +86,8 @@ class OtherUserProfileScreenViewModelTest {
val groupState = viewModel.state.groupState

// then
coVerify {
arrangement.observeConversationRoleForUserUseCase(any(), any()) wasNot Called
coVerify(exactly = 0) {
arrangement.observeConversationRoleForUserUseCase(any(), any())
}
assertEquals(groupState, null)
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ androidx-text-archCore = "2.2.0"
junit4 = "4.13.2"
junit5 = "5.11.0"
kluent = "1.73"
mockk = "1.13.10"
mockk = "1.13.16"
okio = "3.9.0"
turbine = "1.2.0"
robolectric = "4.12.2"
Expand Down
Loading