diff --git a/features/ftue/test/build.gradle.kts b/features/ftue/test/build.gradle.kts new file mode 100644 index 0000000000..eb7a3a565c --- /dev/null +++ b/features/ftue/test/build.gradle.kts @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("io.element.android-compose-library") + alias(libs.plugins.anvil) + alias(libs.plugins.ksp) + id("kotlin-parcelize") +} + +android { + namespace = "io.element.android.features.ftue.test" +} + +dependencies { + implementation(projects.features.ftue.api) + implementation(projects.tests.testutils) +} diff --git a/features/ftue/test/src/main/kotlin/io/element/android/features/ftue/test/FakeFtueService.kt b/features/ftue/test/src/main/kotlin/io/element/android/features/ftue/test/FakeFtueService.kt new file mode 100644 index 0000000000..4f69abd793 --- /dev/null +++ b/features/ftue/test/src/main/kotlin/io/element/android/features/ftue/test/FakeFtueService.kt @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.element.android.features.ftue.test + +import io.element.android.features.ftue.api.state.FtueService +import io.element.android.features.ftue.api.state.FtueState +import io.element.android.tests.testutils.lambda.lambdaError +import kotlinx.coroutines.flow.MutableStateFlow + +class FakeFtueService( + private val resetLambda: () -> Unit = { lambdaError() }, +) : FtueService { + override val state: MutableStateFlow = MutableStateFlow(FtueState.Unknown) + + override suspend fun reset() { + resetLambda() + } + + suspend fun emitState(newState: FtueState) { + state.emit(newState) + } +}