Fix test and add new tests.

This commit is contained in:
Benoit Marty 2024-06-05 18:46:14 +02:00 committed by Benoit Marty
parent 67608cd16e
commit 050dbdfa7c

View file

@ -209,13 +209,33 @@ class IntentResolverTest {
permalinkParserResult = { permalinkData }
)
val intent = Intent(RuntimeEnvironment.getApplication(), Activity::class.java).apply {
action = Intent.ACTION_SEND
action = Intent.ACTION_BATTERY_LOW
data = "https://matrix.to/invalid".toUri()
}
val result = sut.resolve(intent)
assertThat(result).isNull()
}
@Test
fun `test incoming share simple`() {
val sut = createIntentResolver()
val intent = Intent(RuntimeEnvironment.getApplication(), Activity::class.java).apply {
action = Intent.ACTION_SEND
}
val result = sut.resolve(intent)
assertThat(result).isEqualTo(ResolvedIntent.IncomingShare(intent = intent))
}
@Test
fun `test incoming share multiple`() {
val sut = createIntentResolver()
val intent = Intent(RuntimeEnvironment.getApplication(), Activity::class.java).apply {
action = Intent.ACTION_SEND_MULTIPLE
}
val result = sut.resolve(intent)
assertThat(result).isEqualTo(ResolvedIntent.IncomingShare(intent = intent))
}
@Test
fun `test resolve invalid`() {
val sut = createIntentResolver(