Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jayohms committed Feb 23, 2024
1 parent 1732239 commit 092da82
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion turbo/src/main/assets/json/test-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
{
"patterns": [
"/toolbar/"
"/new-home"
],
"properties": {
"uri": "turbo://fragment/web/home",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class TurboPathConfigurationRepositoryTest : BaseRepositoryTest() {
assertThat(json).isNotNull()

val config = load(json)
assertThat(config?.rules?.size).isEqualTo(9)
assertThat(config?.rules?.size).isEqualTo(10)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TurboPathConfigurationTest : BaseRepositoryTest() {

@Test
fun assetConfigurationIsLoaded() {
assertThat(pathConfiguration.rules.size).isEqualTo(9)
assertThat(pathConfiguration.rules.size).isEqualTo(10)
}

@Test
Expand Down
10 changes: 5 additions & 5 deletions turbo/src/test/kotlin/dev/hotwire/turbo/nav/TurboNavRuleTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TurboNavRuleTest {
private lateinit var pathConfiguration: TurboPathConfiguration

private val homeUrl = "https://hotwired.dev/home"
private val toolbarUrl = "https://hotwired.dev/toolbar/first"
private val newHomeUrl = "https://hotwired.dev/new-home"
private val featureUrl = "https://hotwired.dev/feature"
private val newUrl = "https://hotwired.dev/feature/new"
private val editUrl = "https://hotwired.dev/feature/edit"
Expand Down Expand Up @@ -146,17 +146,17 @@ class TurboNavRuleTest {

@Test
fun `replace root when navigating in default context`() {
controller.navigate(webHomeDestinationId, locationArgs(homeUrl))
val rule = getNavigatorRule(toolbarUrl)
controller.navigate(webDestinationId, locationArgs(featureUrl))
val rule = getNavigatorRule(newHomeUrl)

// Current destination
assertThat(rule.previousLocation).isEqualTo(homeUrl)
assertThat(rule.currentLocation).isEqualTo(homeUrl)
assertThat(rule.currentLocation).isEqualTo(featureUrl)
assertThat(rule.currentPresentationContext).isEqualTo(TurboNavPresentationContext.DEFAULT)
assertThat(rule.isAtStartDestination).isFalse()

// New destination
assertThat(rule.newLocation).isEqualTo(toolbarUrl)
assertThat(rule.newLocation).isEqualTo(newHomeUrl)
assertThat(rule.newPresentationContext).isEqualTo(TurboNavPresentationContext.DEFAULT)
assertThat(rule.newPresentation).isEqualTo(TurboNavPresentation.REPLACE_ROOT)
assertThat(rule.newQueryStringPresentation).isEqualTo(TurboNavQueryStringPresentation.DEFAULT)
Expand Down

0 comments on commit 092da82

Please sign in to comment.