@@ -14,9 +14,7 @@ import androidx.core.net.toUri
14
14
import com.google.common.truth.Truth.assertThat
15
15
import io.element.android.features.login.api.LoginParams
16
16
import io.element.android.features.login.test.FakeLoginIntentResolver
17
- import io.element.android.libraries.deeplink.DeepLinkCreator
18
- import io.element.android.libraries.deeplink.DeeplinkData
19
- import io.element.android.libraries.deeplink.DeeplinkParser
17
+ import io.element.android.libraries.deeplink.api.DeeplinkData
20
18
import io.element.android.libraries.matrix.api.core.UserId
21
19
import io.element.android.libraries.matrix.api.permalink.PermalinkData
22
20
import io.element.android.libraries.matrix.test.A_ROOM_ID
@@ -46,15 +44,11 @@ class IntentResolverTest {
46
44
47
45
@Test
48
46
fun `test resolve navigation intent root` () {
49
- val sut = createIntentResolver()
47
+ val sut = createIntentResolver(
48
+ deeplinkParserResult = DeeplinkData .Root (A_SESSION_ID )
49
+ )
50
50
val intent = Intent (RuntimeEnvironment .getApplication(), Activity ::class .java).apply {
51
51
action = Intent .ACTION_VIEW
52
- data = DeepLinkCreator ().room(
53
- sessionId = A_SESSION_ID ,
54
- roomId = null ,
55
- threadId = null ,
56
- )
57
- .toUri()
58
52
}
59
53
val result = sut.resolve(intent)
60
54
assertThat(result).isEqualTo(
@@ -68,15 +62,15 @@ class IntentResolverTest {
68
62
69
63
@Test
70
64
fun `test resolve navigation intent room` () {
71
- val sut = createIntentResolver()
72
- val intent = Intent (RuntimeEnvironment .getApplication(), Activity ::class .java).apply {
73
- action = Intent .ACTION_VIEW
74
- data = DeepLinkCreator ().room(
65
+ val sut = createIntentResolver(
66
+ deeplinkParserResult = DeeplinkData .Room (
75
67
sessionId = A_SESSION_ID ,
76
68
roomId = A_ROOM_ID ,
77
69
threadId = null ,
78
70
)
79
- .toUri()
71
+ )
72
+ val intent = Intent (RuntimeEnvironment .getApplication(), Activity ::class .java).apply {
73
+ action = Intent .ACTION_VIEW
80
74
}
81
75
val result = sut.resolve(intent)
82
76
assertThat(result).isEqualTo(
@@ -92,15 +86,15 @@ class IntentResolverTest {
92
86
93
87
@Test
94
88
fun `test resolve navigation intent thread` () {
95
- val sut = createIntentResolver()
96
- val intent = Intent (RuntimeEnvironment .getApplication(), Activity ::class .java).apply {
97
- action = Intent .ACTION_VIEW
98
- data = DeepLinkCreator ().room(
89
+ val sut = createIntentResolver(
90
+ deeplinkParserResult = DeeplinkData .Room (
99
91
sessionId = A_SESSION_ID ,
100
92
roomId = A_ROOM_ID ,
101
93
threadId = A_THREAD_ID ,
102
94
)
103
- .toUri()
95
+ )
96
+ val intent = Intent (RuntimeEnvironment .getApplication(), Activity ::class .java).apply {
97
+ action = Intent .ACTION_VIEW
104
98
}
105
99
val result = sut.resolve(intent)
106
100
assertThat(result).isEqualTo(
@@ -240,12 +234,13 @@ class IntentResolverTest {
240
234
}
241
235
242
236
private fun createIntentResolver (
237
+ deeplinkParserResult : DeeplinkData ? = null,
243
238
permalinkParserResult : (String ) -> PermalinkData = { lambdaError() },
244
239
loginIntentResolverResult : (String ) -> LoginParams ? = { lambdaError() },
245
240
oidcIntentResolverResult : (Intent ) -> OidcAction ? = { lambdaError() },
246
241
): IntentResolver {
247
242
return IntentResolver (
248
- deeplinkParser = DeeplinkParser () ,
243
+ deeplinkParser = { deeplinkParserResult } ,
249
244
loginIntentResolver = FakeLoginIntentResolver (
250
245
parseResult = loginIntentResolverResult,
251
246
),
0 commit comments