Fixing attempt of unit tests

This commit is contained in:
Maxime NATUREL 2022-03-30 09:33:43 +02:00
parent 2b41096518
commit f4ef4c2e61
2 changed files with 6 additions and 0 deletions

View File

@ -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()

View File

@ -26,4 +26,8 @@ class FakeVectorFeatures : VectorFeatures by spyk<DefaultVectorFeatures>() {
fun givenPersonalisationEnabled() {
every { isOnboardingPersonalizeEnabled() } returns true
}
fun givenLiveLocationSharingEnabled() {
every { isLiveLocationEnabled() } returns true
}
}