From f4ef4c2e617ac0b6e2cba813955a5695428570bd Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Wed, 30 Mar 2022 09:33:43 +0200 Subject: [PATCH] Fixing attempt of unit tests --- .../vector/app/features/onboarding/OnboardingViewModelTest.kt | 2 ++ .../test/java/im/vector/app/test/fakes/FakeVectorFeatures.kt | 4 ++++ 2 files changed, 6 insertions(+) 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 a682d025b8..a4983ba54a 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 @@ -227,6 +227,7 @@ class OnboardingViewModelTest { @Test fun `given personalisation enabled, when registering account, then updates state and emits account created event`() = runTest { fakeVectorFeatures.givenPersonalisationEnabled() + fakeVectorFeatures.givenLiveLocationSharingEnabled() givenRegistrationResultFor(A_LOADABLE_REGISTER_ACTION, RegistrationResult.Success(fakeSession)) givenSuccessfullyCreatesAccount(A_HOMESERVER_CAPABILITIES) val test = viewModel.test() @@ -246,6 +247,7 @@ 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() + fakeVectorFeatures.givenLiveLocationSharingEnabled() givenSuccessfulRegistrationForStartAndDummySteps(missingStages = listOf(Stage.Dummy(mandatory = true))) val test = viewModel.test() diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeVectorFeatures.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeVectorFeatures.kt index aeabcce7cd..680dc520ee 100644 --- a/vector/src/test/java/im/vector/app/test/fakes/FakeVectorFeatures.kt +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeVectorFeatures.kt @@ -26,4 +26,8 @@ class FakeVectorFeatures : VectorFeatures by spyk() { fun givenPersonalisationEnabled() { every { isOnboardingPersonalizeEnabled() } returns true } + + fun givenLiveLocationSharingEnabled() { + every { isLiveLocationEnabled() } returns true + } }