Skip to content

Commit 1d0af23

Browse files
committed
Add test for the scheme io.element.call
1 parent 1244761 commit 1d0af23

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

features/call/src/test/kotlin/io/element/android/features/call/CallIntentDataParserTests.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ class CallIntentDataParserTests {
8383
assertThat(callIntentDataParser.parse(url)).isEqualTo(embeddedUrl)
8484
}
8585

86+
@Test
87+
fun `element scheme 2 with url param gets url extracted`() {
88+
val embeddedUrl = "http://call.element.io/some-actual-call?with=parameters"
89+
val encodedUrl = URLEncoder.encode(embeddedUrl, "utf-8")
90+
val url = "io.element.call:/?url=$encodedUrl"
91+
assertThat(callIntentDataParser.parse(url)).isEqualTo(embeddedUrl)
92+
}
93+
8694
@Test
8795
fun `element scheme with call host and no url param returns null`() {
8896
val embeddedUrl = "http://call.element.io/some-actual-call?with=parameters"
@@ -91,6 +99,14 @@ class CallIntentDataParserTests {
9199
assertThat(callIntentDataParser.parse(url)).isNull()
92100
}
93101

102+
@Test
103+
fun `element scheme 2 with no url returns null`() {
104+
val embeddedUrl = "http://call.element.io/some-actual-call?with=parameters"
105+
val encodedUrl = URLEncoder.encode(embeddedUrl, "utf-8")
106+
val url = "io.element.call:/?no_url=$encodedUrl"
107+
assertThat(callIntentDataParser.parse(url)).isNull()
108+
}
109+
94110
@Test
95111
fun `element scheme with no call host returns null`() {
96112
val embeddedUrl = "http://call.element.io/some-actual-call?with=parameters"
@@ -104,4 +120,10 @@ class CallIntentDataParserTests {
104120
val url = "element://call?url="
105121
assertThat(callIntentDataParser.parse(url)).isNull()
106122
}
123+
124+
@Test
125+
fun `element scheme 2 with no data returns null`() {
126+
val url = "io.element.call:/?url="
127+
assertThat(callIntentDataParser.parse(url)).isNull()
128+
}
107129
}

0 commit comments

Comments
 (0)