-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from arkivanov/merge-master-to-compose-darwin
Merge master into compose-darwin
- Loading branch information
Showing
10 changed files
with
215 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/RouterPopWhileTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.arkivanov.decompose.router | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertTrue | ||
|
||
@Suppress("TestFunctionName") | ||
class RouterPopWhileTest { | ||
|
||
@Test | ||
fun WHEN_popWhile_THEN_popped() { | ||
val router = TestRouter(listOf(1, 2, 3, 4)) | ||
|
||
router.popWhile { it != 2 } | ||
|
||
assertEquals(listOf(1, 2), router.stack) | ||
} | ||
|
||
@Test | ||
fun WHEN_popWhile_THEN_onComplete_called() { | ||
val router = TestRouter(listOf(1, 2, 3, 4)) | ||
var isCalled = false | ||
|
||
router.popWhile(predicate = { it != 2 }, onComplete = { isCalled = true }) | ||
|
||
assertTrue(isCalled) | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/RouterPushTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.arkivanov.decompose.router | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertTrue | ||
|
||
@Suppress("TestFunctionName") | ||
class RouterPushTest { | ||
|
||
@Test | ||
fun WHEN_push_THEN_pushed() { | ||
val router = TestRouter(listOf(1, 2)) | ||
|
||
router.push(3) | ||
|
||
assertEquals(listOf(1, 2, 3), router.stack) | ||
} | ||
|
||
@Test | ||
fun WHEN_push_THEN_onComplete_called() { | ||
val router = TestRouter(listOf(1, 2)) | ||
var isCalled = false | ||
|
||
router.push(3) { isCalled = true } | ||
|
||
assertTrue(isCalled) | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
decompose/src/commonTest/kotlin/com/arkivanov/decompose/router/RouterReplaceCurrentTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.arkivanov.decompose.router | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertTrue | ||
|
||
@Suppress("TestFunctionName") | ||
class RouterReplaceCurrentTest { | ||
|
||
@Test | ||
fun WHEN_replaceCurrent_THEN_last_configuration_replaced() { | ||
val router = TestRouter(listOf(1, 2, 3)) | ||
|
||
router.replaceCurrent(4) | ||
|
||
assertEquals(listOf(1, 2, 4), router.stack) | ||
} | ||
|
||
@Test | ||
fun WHEN_replaceCurrent_THEN_onComplete_called() { | ||
val router = TestRouter(listOf(1, 2, 3)) | ||
var isCalled = false | ||
|
||
router.replaceCurrent(4) { isCalled = true } | ||
|
||
assertTrue(isCalled) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.