Add test for the scheme io.element.call

This commit is contained in:
Benoit Marty
2023-09-20 11:18:51 +02:00
parent 6b2c48972c
commit b0dc826227

View File

@@ -83,6 +83,14 @@ class CallIntentDataParserTests {
assertThat(callIntentDataParser.parse(url)).isEqualTo(embeddedUrl)
}
@Test
fun `element scheme 2 with url param gets url extracted`() {
val embeddedUrl = "http://call.element.io/some-actual-call?with=parameters"
val encodedUrl = URLEncoder.encode(embeddedUrl, "utf-8")
val url = "io.element.call:/?url=$encodedUrl"
assertThat(callIntentDataParser.parse(url)).isEqualTo(embeddedUrl)
}
@Test
fun `element scheme with call host and no url param returns null`() {
val embeddedUrl = "http://call.element.io/some-actual-call?with=parameters"
@@ -91,6 +99,14 @@ class CallIntentDataParserTests {
assertThat(callIntentDataParser.parse(url)).isNull()
}
@Test
fun `element scheme 2 with no url returns null`() {
val embeddedUrl = "http://call.element.io/some-actual-call?with=parameters"
val encodedUrl = URLEncoder.encode(embeddedUrl, "utf-8")
val url = "io.element.call:/?no_url=$encodedUrl"
assertThat(callIntentDataParser.parse(url)).isNull()
}
@Test
fun `element scheme with no call host returns null`() {
val embeddedUrl = "http://call.element.io/some-actual-call?with=parameters"
@@ -104,4 +120,10 @@ class CallIntentDataParserTests {
val url = "element://call?url="
assertThat(callIntentDataParser.parse(url)).isNull()
}
@Test
fun `element scheme 2 with no data returns null`() {
val url = "io.element.call:/?url="
assertThat(callIntentDataParser.parse(url)).isNull()
}
}