Cleanup and remove warning, this code is not reachable by production code.

This commit is contained in:
Benoit Marty
2025-10-24 09:44:30 +02:00
parent b1033c4bf6
commit 712da7a94d

View File

@@ -12,8 +12,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.InternalComposeApi
import androidx.compose.runtime.Stable
import androidx.compose.runtime.currentComposer
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry
@@ -26,8 +24,6 @@ import io.element.android.libraries.architecture.Presenter
/**
* Composable that provides a fake [LifecycleOwner] to the composition.
*
* **WARNING: DO NOT USE OUTSIDE TESTS.**
*/
@OptIn(InternalComposeApi::class)
@Stable
@@ -44,19 +40,16 @@ fun <T> withFakeLifecycleOwner(
/**
* Test a [Presenter] with a fake [LifecycleOwner].
*
* **WARNING: DO NOT USE OUTSIDE TESTS.**
*/
suspend fun <T> Presenter<T>.testWithLifecycleOwner(
lifecycleOwner: FakeLifecycleOwner = FakeLifecycleOwner(),
block: suspend TurbineTestContext<T>.() -> Unit
) {
moleculeFlow(RecompositionMode.Immediate) {
val ret = withFakeLifecycleOwner(lifecycleOwner) {
withFakeLifecycleOwner(lifecycleOwner) {
present()
}
ret
}.test<T>(validate = block)
}.test(validate = block)
}
@SuppressLint("VisibleForTests")