Detekt: fix MaxLineLength

@ouchadam your test fun names are too long!
This commit is contained in:
Benoit Marty 2022-05-12 17:38:49 +02:00
parent aeb6495253
commit 3bc84f0d38
3 changed files with 43 additions and 33 deletions

View File

@ -81,7 +81,7 @@ class DefaultAddPusherTaskTest {
} }
@Test @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() val realmResult = PusherEntity()
monarchy.givenWhereReturns(result = realmResult) monarchy.givenWhereReturns(result = realmResult)
pushersAPI.givenSetPusherErrors(SocketException()) pushersAPI.givenSetPusherErrors(SocketException())

View File

@ -308,49 +308,55 @@ class OnboardingViewModelTest {
} }
@Test @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 { fun `given personalisation enabled and registration has started and has dummy step to do, when handling action, then ignores other steps and does dummy`() {
fakeVectorFeatures.givenPersonalisationEnabled() runTest {
givenSuccessfulRegistrationForStartAndDummySteps(missingStages = listOf(Stage.Dummy(mandatory = true))) fakeVectorFeatures.givenPersonalisationEnabled()
val test = viewModel.test() 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 test
.assertStatesChanges( .assertStatesChanges(
initialState, initialState,
{ copy(isLoading = true) }, { copy(isLoading = true) },
{ copy(isLoading = false, personalizationState = A_HOMESERVER_CAPABILITIES.toPersonalisationState()) } { copy(isLoading = false, personalizationState = A_HOMESERVER_CAPABILITIES.toPersonalisationState()) }
) )
.assertEvents(OnboardingViewEvents.OnAccountCreated) .assertEvents(OnboardingViewEvents.OnAccountCreated)
.finish() .finish()
}
} }
@Test @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 { fun `given changing profile avatar is supported, when updating display name, then updates upstream user display name and moves to choose profile avatar`() {
viewModelWith(initialState.copy(personalizationState = PersonalizationState(supportsChangingProfilePicture = true))) runTest {
val test = viewModel.test() 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 test
.assertStatesChanges(initialState, expectedSuccessfulDisplayNameUpdateStates()) .assertStatesChanges(initialState, expectedSuccessfulDisplayNameUpdateStates())
.assertEvents(OnboardingViewEvents.OnChooseProfilePicture) .assertEvents(OnboardingViewEvents.OnChooseProfilePicture)
.finish() .finish()
fakeSession.fakeProfileService.verifyUpdatedName(fakeSession.myUserId, A_DISPLAY_NAME) fakeSession.fakeProfileService.verifyUpdatedName(fakeSession.myUserId, A_DISPLAY_NAME)
}
} }
@Test @Test
fun `given changing profile picture is not supported, when updating display name, then updates upstream user display name and completes personalization`() = runTest { fun `given changing profile avatar is not supported, when updating display name, then updates upstream user display name and completes personalization`() {
viewModelWith(initialState.copy(personalizationState = PersonalizationState(supportsChangingProfilePicture = false))) runTest {
val test = viewModel.test() 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 test
.assertStatesChanges(initialState, expectedSuccessfulDisplayNameUpdateStates()) .assertStatesChanges(initialState, expectedSuccessfulDisplayNameUpdateStates())
.assertEvents(OnboardingViewEvents.OnPersonalizationComplete) .assertEvents(OnboardingViewEvents.OnPersonalizationComplete)
.finish() .finish()
fakeSession.fakeProfileService.verifyUpdatedName(fakeSession.myUserId, A_DISPLAY_NAME) fakeSession.fakeProfileService.verifyUpdatedName(fakeSession.myUserId, A_DISPLAY_NAME)
}
} }
@Test @Test

View File

@ -34,7 +34,11 @@ class FakeSharedSecretStorageService : SharedSecretStorageService {
TODO("Not yet implemented") 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") TODO("Not yet implemented")
} }