mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 08:15:02 +00:00
Cleanup and remove warning, this code is not reachable by production code.
This commit is contained in:
+2
-9
@@ -12,8 +12,6 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.runtime.InternalComposeApi
|
import androidx.compose.runtime.InternalComposeApi
|
||||||
import androidx.compose.runtime.Stable
|
import androidx.compose.runtime.Stable
|
||||||
import androidx.compose.runtime.currentComposer
|
import androidx.compose.runtime.currentComposer
|
||||||
import androidx.compose.runtime.getValue
|
|
||||||
import androidx.compose.runtime.setValue
|
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.LifecycleOwner
|
import androidx.lifecycle.LifecycleOwner
|
||||||
import androidx.lifecycle.LifecycleRegistry
|
import androidx.lifecycle.LifecycleRegistry
|
||||||
@@ -26,8 +24,6 @@ import io.element.android.libraries.architecture.Presenter
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable that provides a fake [LifecycleOwner] to the composition.
|
* Composable that provides a fake [LifecycleOwner] to the composition.
|
||||||
*
|
|
||||||
* **WARNING: DO NOT USE OUTSIDE TESTS.**
|
|
||||||
*/
|
*/
|
||||||
@OptIn(InternalComposeApi::class)
|
@OptIn(InternalComposeApi::class)
|
||||||
@Stable
|
@Stable
|
||||||
@@ -44,19 +40,16 @@ fun <T> withFakeLifecycleOwner(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test a [Presenter] with a fake [LifecycleOwner].
|
* Test a [Presenter] with a fake [LifecycleOwner].
|
||||||
*
|
|
||||||
* **WARNING: DO NOT USE OUTSIDE TESTS.**
|
|
||||||
*/
|
*/
|
||||||
suspend fun <T> Presenter<T>.testWithLifecycleOwner(
|
suspend fun <T> Presenter<T>.testWithLifecycleOwner(
|
||||||
lifecycleOwner: FakeLifecycleOwner = FakeLifecycleOwner(),
|
lifecycleOwner: FakeLifecycleOwner = FakeLifecycleOwner(),
|
||||||
block: suspend TurbineTestContext<T>.() -> Unit
|
block: suspend TurbineTestContext<T>.() -> Unit
|
||||||
) {
|
) {
|
||||||
moleculeFlow(RecompositionMode.Immediate) {
|
moleculeFlow(RecompositionMode.Immediate) {
|
||||||
val ret = withFakeLifecycleOwner(lifecycleOwner) {
|
withFakeLifecycleOwner(lifecycleOwner) {
|
||||||
present()
|
present()
|
||||||
}
|
}
|
||||||
ret
|
}.test(validate = block)
|
||||||
}.test<T>(validate = block)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("VisibleForTests")
|
@SuppressLint("VisibleForTests")
|
||||||
|
|||||||
Reference in New Issue
Block a user