diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/session/pushers/DefaultAddPusherTaskTest.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/session/pushers/DefaultAddPusherTaskTest.kt index 31fd86fe65..32b1d44fb9 100644 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/session/pushers/DefaultAddPusherTaskTest.kt +++ b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/session/pushers/DefaultAddPusherTaskTest.kt @@ -81,7 +81,7 @@ class DefaultAddPusherTaskTest { } @Test - fun `given a persisted push entity and SetPush API fails when adding Pusher then mutates persisted result with Failed registration state and rethrows error`() { + fun `given a persisted push entity and SetPush API fails when adding Pusher then mutates persisted result with Failed registration state and rethrows`() { val realmResult = PusherEntity() monarchy.givenWhereReturns(result = realmResult) pushersAPI.givenSetPusherErrors(SocketException()) diff --git a/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt b/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt index c26c73a9a7..59f6d4ea12 100644 --- a/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt @@ -308,49 +308,55 @@ class OnboardingViewModelTest { } @Test - fun `given personalisation enabled and registration has started and has dummy step to do, when handling action, then ignores other steps and executes dummy`() = runTest { - fakeVectorFeatures.givenPersonalisationEnabled() - givenSuccessfulRegistrationForStartAndDummySteps(missingStages = listOf(Stage.Dummy(mandatory = true))) - val test = viewModel.test() + fun `given personalisation enabled and registration has started and has dummy step to do, when handling action, then ignores other steps and does dummy`() { + runTest { + fakeVectorFeatures.givenPersonalisationEnabled() + givenSuccessfulRegistrationForStartAndDummySteps(missingStages = listOf(Stage.Dummy(mandatory = true))) + val test = viewModel.test() - viewModel.handle(OnboardingAction.PostRegisterAction(A_LOADABLE_REGISTER_ACTION)) + viewModel.handle(OnboardingAction.PostRegisterAction(A_LOADABLE_REGISTER_ACTION)) - test - .assertStatesChanges( - initialState, - { copy(isLoading = true) }, - { copy(isLoading = false, personalizationState = A_HOMESERVER_CAPABILITIES.toPersonalisationState()) } - ) - .assertEvents(OnboardingViewEvents.OnAccountCreated) - .finish() + test + .assertStatesChanges( + initialState, + { copy(isLoading = true) }, + { copy(isLoading = false, personalizationState = A_HOMESERVER_CAPABILITIES.toPersonalisationState()) } + ) + .assertEvents(OnboardingViewEvents.OnAccountCreated) + .finish() + } } @Test - fun `given changing profile picture is supported, when updating display name, then updates upstream user display name and moves to choose profile picture`() = runTest { - viewModelWith(initialState.copy(personalizationState = PersonalizationState(supportsChangingProfilePicture = true))) - val test = viewModel.test() + fun `given changing profile avatar is supported, when updating display name, then updates upstream user display name and moves to choose profile avatar`() { + runTest { + viewModelWith(initialState.copy(personalizationState = PersonalizationState(supportsChangingProfilePicture = true))) + val test = viewModel.test() - viewModel.handle(OnboardingAction.UpdateDisplayName(A_DISPLAY_NAME)) + viewModel.handle(OnboardingAction.UpdateDisplayName(A_DISPLAY_NAME)) - test - .assertStatesChanges(initialState, expectedSuccessfulDisplayNameUpdateStates()) - .assertEvents(OnboardingViewEvents.OnChooseProfilePicture) - .finish() - fakeSession.fakeProfileService.verifyUpdatedName(fakeSession.myUserId, A_DISPLAY_NAME) + test + .assertStatesChanges(initialState, expectedSuccessfulDisplayNameUpdateStates()) + .assertEvents(OnboardingViewEvents.OnChooseProfilePicture) + .finish() + fakeSession.fakeProfileService.verifyUpdatedName(fakeSession.myUserId, A_DISPLAY_NAME) + } } @Test - fun `given changing profile picture is not supported, when updating display name, then updates upstream user display name and completes personalization`() = runTest { - viewModelWith(initialState.copy(personalizationState = PersonalizationState(supportsChangingProfilePicture = false))) - val test = viewModel.test() + fun `given changing profile avatar is not supported, when updating display name, then updates upstream user display name and completes personalization`() { + runTest { + viewModelWith(initialState.copy(personalizationState = PersonalizationState(supportsChangingProfilePicture = false))) + val test = viewModel.test() - viewModel.handle(OnboardingAction.UpdateDisplayName(A_DISPLAY_NAME)) + viewModel.handle(OnboardingAction.UpdateDisplayName(A_DISPLAY_NAME)) - test - .assertStatesChanges(initialState, expectedSuccessfulDisplayNameUpdateStates()) - .assertEvents(OnboardingViewEvents.OnPersonalizationComplete) - .finish() - fakeSession.fakeProfileService.verifyUpdatedName(fakeSession.myUserId, A_DISPLAY_NAME) + test + .assertStatesChanges(initialState, expectedSuccessfulDisplayNameUpdateStates()) + .assertEvents(OnboardingViewEvents.OnPersonalizationComplete) + .finish() + fakeSession.fakeProfileService.verifyUpdatedName(fakeSession.myUserId, A_DISPLAY_NAME) + } } @Test diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeSharedSecretStorageService.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeSharedSecretStorageService.kt index d7d18b925d..c79a0be542 100644 --- a/vector/src/test/java/im/vector/app/test/fakes/FakeSharedSecretStorageService.kt +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeSharedSecretStorageService.kt @@ -34,7 +34,11 @@ class FakeSharedSecretStorageService : SharedSecretStorageService { TODO("Not yet implemented") } - override suspend fun generateKeyWithPassphrase(keyId: String, keyName: String, passphrase: String, keySigner: KeySigner, progressListener: ProgressListener?): SsssKeyCreationInfo { + override suspend fun generateKeyWithPassphrase(keyId: String, + keyName: String, + passphrase: String, + keySigner: KeySigner, + progressListener: ProgressListener?): SsssKeyCreationInfo { TODO("Not yet implemented") }