Skip to content

Commit

Permalink
Add a test to ensure that a resolved location with a trailing slash p…
Browse files Browse the repository at this point in the history
…assing along the bridge message
  • Loading branch information
jayohms committed Feb 27, 2024
1 parent b86e376 commit 4c13175
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions strada/src/test/kotlin/dev/hotwire/strada/BridgeDelegateTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,23 @@ class BridgeDelegateTest {
assertNotNull(delegate.component<TestData.OneBridgeComponent>())
}

@Test
fun bridgeDidReceiveMessageForLocationWithTrailingSlash() {
whenever(webView.url).thenReturn("https://37signals.com/")

val message = Message(
id = "1",
component = "one",
event = "connect",
metadata = Metadata("https://37signals.com/"),
jsonData = """{"title":"Page-title","subtitle":"Page-subtitle"}"""
)

assertNull(delegate.component<TestData.OneBridgeComponent>())
assertEquals(true, delegate.bridgeDidReceiveMessage(message))
assertNotNull(delegate.component<TestData.OneBridgeComponent>())
}

@Test
fun bridgeDidReceiveMessageForResolvedLocation() {
whenever(webView.url).thenReturn("https://37signals.com/new_url")
Expand Down

0 comments on commit 4c13175

Please sign in to comment.