Repository: arkivanov/Decompose
Pull request #722 (2024-06-13 18:33:32)

Added StackNavigator#popToFirst extension function
As part of #721.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Refactor**
	- Renamed stack manipulation functions for improved clarity and consistency (e.g., `drop` to `pop`).

- **Tests**
	- Introduced new test cases for popping to the first element in a stack-based router.
	- Updated tests to reflect changes in stack manipulation function names and parameters.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

coderabbitai[bot]: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- This is an auto-generated comment: summarize review in progress by coderabbit.ai -->

> [!NOTE]
> Currently processing new changes in this PR. This may take a few minutes, please wait...
> 
> <details>
> <summary>Commits</summary>
> 
> Files that changed from the base of the PR and between 42e5e5e9b2a58df0c0e763938328ac1b733fde5e and 021c5290924da39275e1402f03b753adf4efadd4.
> 
> </details>
> 
> 
> <details>
> <summary>Files selected for processing (3)</summary>
> 
> * decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/stack/StackNavigatorExt.kt (4 hunks)
> * decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/stack/RouterPopToFirstTest.kt (1 hunks)
> * decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/stack/RouterPopToTest.kt (1 hunks)
> 
> </details>
> 
> ```ascii
>  _____________________________________________________________________________________________________________
> < Abstraction is not about vagueness, it is about being precise at a new semantic level. - Edsger W. Dijkstra >
>  -------------------------------------------------------------------------------------------------------------
>   \
>    \   (\__/)
>        (•ㅅ•)
>        / 　 づ
> ```

<!-- end of auto-generated comment: summarize review in progress by coderabbit.ai --><!-- tips_start -->

---



Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

<details>
<summary>Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
	- `I pushed a fix in commit <commit_id>.`
	- `Generate unit testing code for this file.`
	- `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
	- `@coderabbitai generate unit testing code for this file.`
	-	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
	- `@coderabbitai generate interesting stats about this repository and render them as a table.`
	- `@coderabbitai show all the console.log statements in this repository.`
	- `@coderabbitai read src/utils.ts and generate unit testing code.`
	- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
	- `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (invoked as PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.


Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.

### CodeRabbit Configration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

Patch:
diff --git a/decompose/api/android/decompose.api b/decompose/api/android/decompose.api
index 688ef6f2..4923f7ab 100644
--- a/decompose/api/android/decompose.api
+++ b/decompose/api/android/decompose.api
@@ -317,6 +317,8 @@ public final class com/arkivanov/decompose/router/stack/StackNavigatorExtKt {
 	public static synthetic fun pop$default (Lcom/arkivanov/decompose/router/stack/StackNavigator;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
 	public static final fun popTo (Lcom/arkivanov/decompose/router/stack/StackNavigator;ILkotlin/jvm/functions/Function1;)V
 	public static synthetic fun popTo$default (Lcom/arkivanov/decompose/router/stack/StackNavigator;ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
+	public static final fun popToFirst (Lcom/arkivanov/decompose/router/stack/StackNavigator;Lkotlin/jvm/functions/Function1;)V
+	public static synthetic fun popToFirst$default (Lcom/arkivanov/decompose/router/stack/StackNavigator;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
 	public static final fun popWhile (Lcom/arkivanov/decompose/router/stack/StackNavigator;Lkotlin/jvm/functions/Function1;)V
 	public static final fun popWhile (Lcom/arkivanov/decompose/router/stack/StackNavigator;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V
 	public static final fun push (Lcom/arkivanov/decompose/router/stack/StackNavigator;Ljava/lang/Object;Lkotlin/jvm/functions/Function0;)V
diff --git a/decompose/api/decompose.klib.api b/decompose/api/decompose.klib.api
index 5f29bb12..e3897f3a 100644
--- a/decompose/api/decompose.klib.api
+++ b/decompose/api/decompose.klib.api
@@ -167,12 +167,6 @@ final class <#A: out kotlin/Any> com.arkivanov.decompose.router.pages/Pages { //
     final val selectedIndex // com.arkivanov.decompose.router.pages/Pages.selectedIndex|{}selectedIndex[0]
         final fun <get-selectedIndex>(): kotlin/Int // com.arkivanov.decompose.router.pages/Pages.selectedIndex.<get-selectedIndex>|<get-selectedIndex>(){}[0]
 }
-final class com.arkivanov.decompose.router.stack.webhistory/DefaultWebHistoryController : com.arkivanov.decompose.router.stack.webhistory/WebHistoryController { // com.arkivanov.decompose.router.stack.webhistory/DefaultWebHistoryController|null[0]
-    constructor <init>() // com.arkivanov.decompose.router.stack.webhistory/DefaultWebHistoryController.<init>|<init>(){}[0]
-    final fun <#A1: kotlin/Any> attach(com.arkivanov.decompose.router.stack/StackNavigator<#A1>, com.arkivanov.decompose.value/Value<com.arkivanov.decompose.router.stack/ChildStack<#A1, *>>, kotlinx.serialization/KSerializer<#A1>, kotlin/Function1<#A1, kotlin/String>, kotlin/Function1<kotlin/String, #A1>, kotlin/Function1<kotlin.collections/List<#A1>, kotlin/Boolean>) // com.arkivanov.decompose.router.stack.webhistory/DefaultWebHistoryController.attach|attach(com.arkivanov.decompose.router.stack.StackNavigator<0:0>;com.arkivanov.decompose.value.Value<com.arkivanov.decompose.router.stack.ChildStack<0:0,*>>;kotlinx.serialization.KSerializer<0:0>;kotlin.Function1<0:0,kotlin.String>;kotlin.Function1<kotlin.String,0:0>;kotlin.Function1<kotlin.collections.List<0:0>,kotlin.Boolean>){0§<kotlin.Any>}[0]
-    final val historyPaths // com.arkivanov.decompose.router.stack.webhistory/DefaultWebHistoryController.historyPaths|{}historyPaths[0]
-        final fun <get-historyPaths>(): kotlin.collections/List<kotlin/String> // com.arkivanov.decompose.router.stack.webhistory/DefaultWebHistoryController.historyPaths.<get-historyPaths>|<get-historyPaths>(){}[0]
-}
 final class com.arkivanov.decompose/DefaultComponentContext : com.arkivanov.decompose/ComponentContext { // com.arkivanov.decompose/DefaultComponentContext|null[0]
     constructor <init>(com.arkivanov.essenty.lifecycle/Lifecycle) // com.arkivanov.decompose/DefaultComponentContext.<init>|<init>(com.arkivanov.essenty.lifecycle.Lifecycle){}[0]
     constructor <init>(com.arkivanov.essenty.lifecycle/Lifecycle, com.arkivanov.essenty.statekeeper/StateKeeper? = ..., com.arkivanov.essenty.instancekeeper/InstanceKeeper? = ..., com.arkivanov.essenty.backhandler/BackHandler? = ...) // com.arkivanov.decompose/DefaultComponentContext.<init>|<init>(com.arkivanov.essenty.lifecycle.Lifecycle;com.arkivanov.essenty.statekeeper.StateKeeper?;com.arkivanov.essenty.instancekeeper.InstanceKeeper?;com.arkivanov.essenty.backhandler.BackHandler?){}[0]
@@ -227,6 +221,7 @@ final fun <#A: kotlin/Any> com.arkivanov.decompose.router.stack/StackNavigation(
 final fun <#A: kotlin/Any> com.arkivanov.decompose.value/MutableValue(#A): com.arkivanov.decompose.value/MutableValue<#A> // com.arkivanov.decompose.value/MutableValue|MutableValue(0:0){0§<kotlin.Any>}[0]
 final fun com.arkivanov.decompose.router.pages/getDefaultPageStatus(kotlin/Int, com.arkivanov.decompose.router.pages/Pages<*>): com.arkivanov.decompose.router.children/ChildNavState.Status // com.arkivanov.decompose.router.pages/getDefaultPageStatus|getDefaultPageStatus(kotlin.Int;com.arkivanov.decompose.router.pages.Pages<*>){}[0]
 final inline fun (com.arkivanov.decompose.router.slot/SlotNavigator<*>).com.arkivanov.decompose.router.slot/dismiss(crossinline kotlin/Function1<kotlin/Boolean, kotlin/Unit> = ...) // com.arkivanov.decompose.router.slot/dismiss|dismiss@com.arkivanov.decompose.router.slot.SlotNavigator<*>(kotlin.Function1<kotlin.Boolean,kotlin.Unit>){}[0]
+final inline fun (com.arkivanov.decompose.router.stack/StackNavigator<*>).com.arkivanov.decompose.router.stack/popToFirst(crossinline kotlin/Function1<kotlin/Boolean, kotlin/Unit> = ...) // com.arkivanov.decompose.router.stack/popToFirst|popToFirst@com.arkivanov.decompose.router.stack.StackNavigator<*>(kotlin.Function1<kotlin.Boolean,kotlin.Unit>){}[0]
 final inline fun <#A: kotlin/Any> (com.arkivanov.decompose.router.slot/SlotNavigator<#A>).com.arkivanov.decompose.router.slot/activate(#A, crossinline kotlin/Function0<kotlin/Unit> = ...) // com.arkivanov.decompose.router.slot/activate|activate@com.arkivanov.decompose.router.slot.SlotNavigator<0:0>(0:0;kotlin.Function0<kotlin.Unit>){0§<kotlin.Any>}[0]
 final inline fun <#A: kotlin/Any> (com.arkivanov.decompose.router.stack/StackNavigator<#A>).com.arkivanov.decompose.router.stack/bringToFront(#A, crossinline kotlin/Function0<kotlin/Unit> = ...) // com.arkivanov.decompose.router.stack/bringToFront|bringToFront@com.arkivanov.decompose.router.stack.StackNavigator<0:0>(0:0;kotlin.Function0<kotlin.Unit>){0§<kotlin.Any>}[0]
 final inline fun <#A: kotlin/Any> (com.arkivanov.decompose.router.stack/StackNavigator<#A>).com.arkivanov.decompose.router.stack/pop(crossinline kotlin/Function1<kotlin/Boolean, kotlin/Unit> = ...) // com.arkivanov.decompose.router.stack/pop|pop@com.arkivanov.decompose.router.stack.StackNavigator<0:0>(kotlin.Function1<kotlin.Boolean,kotlin.Unit>){0§<kotlin.Any>}[0]
@@ -290,3 +285,10 @@ sealed class <#A: out kotlin/Any, #B: out kotlin/Any> com.arkivanov.decompose/Ch
             final fun <get-instance>(): kotlin/Nothing? // com.arkivanov.decompose/Child.Destroyed.instance.<get-instance>|<get-instance>(){}[0]
     }
 }
+// Targets: [js, wasmJs]
+final class com.arkivanov.decompose.router.stack.webhistory/DefaultWebHistoryController : com.arkivanov.decompose.router.stack.webhistory/WebHistoryController { // com.arkivanov.decompose.router.stack.webhistory/DefaultWebHistoryController|null[0]
+    constructor <init>() // com.arkivanov.decompose.router.stack.webhistory/DefaultWebHistoryController.<init>|<init>(){}[0]
+    final fun <#A1: kotlin/Any> attach(com.arkivanov.decompose.router.stack/StackNavigator<#A1>, com.arkivanov.decompose.value/Value<com.arkivanov.decompose.router.stack/ChildStack<#A1, *>>, kotlinx.serialization/KSerializer<#A1>, kotlin/Function1<#A1, kotlin/String>, kotlin/Function1<kotlin/String, #A1>, kotlin/Function1<kotlin.collections/List<#A1>, kotlin/Boolean>) // com.arkivanov.decompose.router.stack.webhistory/DefaultWebHistoryController.attach|attach(com.arkivanov.decompose.router.stack.StackNavigator<0:0>;com.arkivanov.decompose.value.Value<com.arkivanov.decompose.router.stack.ChildStack<0:0,*>>;kotlinx.serialization.KSerializer<0:0>;kotlin.Function1<0:0,kotlin.String>;kotlin.Function1<kotlin.String,0:0>;kotlin.Function1<kotlin.collections.List<0:0>,kotlin.Boolean>){0§<kotlin.Any>}[0]
+    final val historyPaths // com.arkivanov.decompose.router.stack.webhistory/DefaultWebHistoryController.historyPaths|{}historyPaths[0]
+        final fun <get-historyPaths>(): kotlin.collections/List<kotlin/String> // com.arkivanov.decompose.router.stack.webhistory/DefaultWebHistoryController.historyPaths.<get-historyPaths>|<get-historyPaths>(){}[0]
+}
diff --git a/decompose/api/jvm/decompose.api b/decompose/api/jvm/decompose.api
index 7168ff6e..50bc4f4c 100644
--- a/decompose/api/jvm/decompose.api
+++ b/decompose/api/jvm/decompose.api
@@ -297,6 +297,8 @@ public final class com/arkivanov/decompose/router/stack/StackNavigatorExtKt {
 	public static synthetic fun pop$default (Lcom/arkivanov/decompose/router/stack/StackNavigator;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
 	public static final fun popTo (Lcom/arkivanov/decompose/router/stack/StackNavigator;ILkotlin/jvm/functions/Function1;)V
 	public static synthetic fun popTo$default (Lcom/arkivanov/decompose/router/stack/StackNavigator;ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
+	public static final fun popToFirst (Lcom/arkivanov/decompose/router/stack/StackNavigator;Lkotlin/jvm/functions/Function1;)V
+	public static synthetic fun popToFirst$default (Lcom/arkivanov/decompose/router/stack/StackNavigator;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
 	public static final fun popWhile (Lcom/arkivanov/decompose/router/stack/StackNavigator;Lkotlin/jvm/functions/Function1;)V
 	public static final fun popWhile (Lcom/arkivanov/decompose/router/stack/StackNavigator;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V
 	public static final fun push (Lcom/arkivanov/decompose/router/stack/StackNavigator;Ljava/lang/Object;Lkotlin/jvm/functions/Function0;)V
diff --git a/decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/stack/StackNavigatorExt.kt b/decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/stack/StackNavigatorExt.kt
index d2a8026d..e3a1d5de 100644
--- a/decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/stack/StackNavigatorExt.kt
+++ b/decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/stack/StackNavigatorExt.kt
@@ -75,7 +75,7 @@ inline fun <C : Any> StackNavigator<C>.pop(crossinline onComplete: (isSuccess: B
 }
 
 /**
- * Drops the configurations at the top of the stack while the [predicate] returns `true`.
+ * Pops configurations at the top of the stack while the [predicate] returns `true`.
  * If the [predicate] returns `true` for every configuration, then the first (oldest) configuration
  * remains in the stack.
  */
@@ -84,7 +84,7 @@ inline fun <C : Any> StackNavigator<C>.popWhile(crossinline predicate: (C) -> Bo
 }
 
 /**
- * Drops the configurations at the top of the stack while the [predicate] returns true.
+ * Pops configurations at the top of the stack while the [predicate] returns true.
  * If the [predicate] returns `true` for every configuration, then the first (oldest) configuration
  * remains in the stack.
  *
@@ -102,7 +102,7 @@ inline fun <C : Any> StackNavigator<C>.popWhile(
 }
 
 /**
- * Drops configurations at the top of the stack so that the provided index becomes active (the new top of the stack).
+ * Pops configurations at the top of the stack so that the provided index becomes active (the new top of the stack).
  *
  * @param index the index of the configuration to become active. Must not be negative.
  * @param onComplete called when the navigation is finished (either synchronously or asynchronously).
@@ -120,6 +120,19 @@ inline fun <C : Any> StackNavigator<C>.popTo(
     )
 }
 
+/**
+ * Pops configurations at the top of the stack so that the first configuration becomes active (the new top of the stack).
+ * Does nothing if there is only one component in the stack.
+ *
+ * Equivalent to `popTo(index = 0)`.
+ *
+ * @param onComplete called when the navigation is finished (either synchronously or asynchronously).
+ * The `isSuccess` argument is `true` if at least one component has been popped.
+ */
+inline fun StackNavigator<*>.popToFirst(crossinline onComplete: (isSuccess: Boolean) -> Unit = {}) {
+    popTo(index = 0, onComplete = onComplete)
+}
+
 /**
  * Replaces the current configuration at the top of the stack with the provided [configuration].
  *


Test patch:
diff --git a/decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/stack/RouterPopToFirstTest.kt b/decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/stack/RouterPopToFirstTest.kt
new file mode 100644
index 00000000..6420c4b1
--- /dev/null
+++ b/decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/stack/RouterPopToFirstTest.kt
@@ -0,0 +1,72 @@
+package com.arkivanov.decompose.router.stack
+
+import kotlin.test.Test
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
+
+@Suppress("TestFunctionName")
+class RouterPopToFirstTest {
+
+    @Test
+    fun GIVEN_stack_size_3_WHEN_popToFirst_THEN_popped() {
+        val navigator = TestStackNavigator(listOf(Config.A, Config.B, Config.C))
+
+        navigator.popToFirst()
+
+        assertEquals(listOf(Config.A), navigator.configurations)
+    }
+
+    @Test
+    fun GIVEN_stack_size_3_WHEN_popToFirst_THEN_onComplete_success() {
+        val navigator = TestStackNavigator(listOf(Config.A, Config.B, Config.C))
+        var isSuccess = false
+
+        navigator.popToFirst { isSuccess = it }
+
+        assertTrue(isSuccess)
+    }
+
+    @Test
+    fun GIVEN_stack_size_2_WHEN_popToFirst_THEN_popped() {
+        val navigator = TestStackNavigator(listOf(Config.A, Config.B))
+
+        navigator.popToFirst()
+
+        assertEquals(listOf(Config.A), navigator.configurations)
+    }
+
+    @Test
+    fun GIVEN_stack_size_2_WHEN_popToFirst_THEN_onComplete_success() {
+        val navigator = TestStackNavigator(listOf(Config.A, Config.B))
+        var isSuccess = false
+
+        navigator.popToFirst { isSuccess = it }
+
+        assertTrue(isSuccess)
+    }
+
+    @Test
+    fun GIVEN_stack_size_1_WHEN_popToFirst_THEN_not_popped() {
+        val navigator = TestStackNavigator(listOf(Config.A))
+
+        navigator.popToFirst()
+
+        assertEquals(listOf(Config.A), navigator.configurations)
+    }
+
+    @Test
+    fun GIVEN_stack_size_1_WHEN_popToFirst_THEN_onComplete_not_success() {
+        val navigator = TestStackNavigator(listOf(Config.A))
+        var isSuccess: Boolean? = null
+
+        navigator.popToFirst { isSuccess = it }
+
+        assertEquals(false, isSuccess)
+    }
+
+    private sealed class Config {
+        data object A : Config()
+        data object B : Config()
+        data object C : Config()
+    }
+}
diff --git a/decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/stack/RouterPopToTest.kt b/decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/stack/RouterPopToTest.kt
index ff195b45..b4b351d8 100644
--- a/decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/stack/RouterPopToTest.kt
+++ b/decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/stack/RouterPopToTest.kt
@@ -116,7 +116,7 @@ class RouterPopToTest {
         val navigator = TestStackNavigator(listOf(Config.A))
         var isSuccess: Boolean? = null
 
-        navigator.pop { isSuccess = it }
+        navigator.popTo(index = 0) { isSuccess = it }
 
         assertEquals(false, isSuccess)
     }