Cleanup and remove warning, this code is not reachable by production code.
This commit is contained in:
parent
b1033c4bf6
commit
712da7a94d
1 changed files with 2 additions and 9 deletions
|
|
@ -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")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue