@@ -14,7 +14,6 @@ import com.google.common.truth.Truth.assertThat
14
14
import io.element.android.features.call.api.CallType
15
15
import io.element.android.features.call.test.FakeElementCallEntryPoint
16
16
import io.element.android.libraries.core.meta.BuildMeta
17
- import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
18
17
import io.element.android.libraries.matrix.api.core.EventId
19
18
import io.element.android.libraries.matrix.api.core.RoomId
20
19
import io.element.android.libraries.matrix.api.core.SessionId
@@ -28,7 +27,6 @@ import io.element.android.libraries.matrix.test.A_ROOM_ID
28
27
import io.element.android.libraries.matrix.test.A_SECRET
29
28
import io.element.android.libraries.matrix.test.A_SESSION_ID
30
29
import io.element.android.libraries.matrix.test.A_USER_ID
31
- import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService
32
30
import io.element.android.libraries.matrix.test.core.aBuildMeta
33
31
import io.element.android.libraries.push.impl.history.FakePushHistoryService
34
32
import io.element.android.libraries.push.impl.history.PushHistoryService
@@ -181,7 +179,7 @@ class DefaultPushHandlerTest {
181
179
}
182
180
183
181
@Test
184
- fun `when PushData is received, but client secret is not known, fallback the latest session ` () =
182
+ fun `when PushData is received, but client secret is not known, nothing happen ` () =
185
183
runTest {
186
184
val aNotifiableMessageEvent = aNotifiableMessageEvent()
187
185
val notifiableEventResult =
@@ -207,58 +205,6 @@ class DefaultPushHandlerTest {
207
205
pushClientSecret = FakePushClientSecret (
208
206
getUserIdFromSecretResult = { null }
209
207
),
210
- matrixAuthenticationService = FakeMatrixAuthenticationService ().apply {
211
- getLatestSessionIdLambda = { A_USER_ID }
212
- },
213
- incrementPushCounterResult = incrementPushCounterResult,
214
- pushHistoryService = pushHistoryService,
215
- )
216
- defaultPushHandler.handle(aPushData, A_PUSHER_INFO )
217
-
218
- advanceTimeBy(300 .milliseconds)
219
-
220
- incrementPushCounterResult.assertions()
221
- .isCalledOnce()
222
- notifiableEventResult.assertions()
223
- .isCalledOnce()
224
- .with (value(A_USER_ID ), any())
225
- onNotifiableEventsReceived.assertions()
226
- .isCalledOnce()
227
- .with (value(listOf (aNotifiableMessageEvent)))
228
- onPushReceivedResult.assertions()
229
- .isCalledOnce()
230
- }
231
-
232
- @Test
233
- fun `when PushData is received, but client secret is not known, and there is no latest session, nothing happen` () =
234
- runTest {
235
- val aNotifiableMessageEvent = aNotifiableMessageEvent()
236
- val notifiableEventResult =
237
- lambdaRecorder<SessionId , List <NotificationEventRequest >, Result <Map <NotificationEventRequest , Result <ResolvedPushEvent >>>> { _, _ ->
238
- val request = NotificationEventRequest (A_SESSION_ID , A_ROOM_ID , AN_EVENT_ID , A_PUSHER_INFO )
239
- Result .success(mapOf (request to Result .success(ResolvedPushEvent .Event (aNotifiableMessageEvent))))
240
- }
241
- val onNotifiableEventsReceived = lambdaRecorder<List <NotifiableEvent >, Unit > {}
242
- val incrementPushCounterResult = lambdaRecorder<Unit > {}
243
- val aPushData = PushData (
244
- eventId = AN_EVENT_ID ,
245
- roomId = A_ROOM_ID ,
246
- unread = 0 ,
247
- clientSecret = A_SECRET ,
248
- )
249
- val onPushReceivedResult = lambdaRecorder<String , EventId ?, RoomId ?, SessionId ?, Boolean , Boolean , String ?, Unit > { _, _, _, _, _, _, _ -> }
250
- val pushHistoryService = FakePushHistoryService (
251
- onPushReceivedResult = onPushReceivedResult,
252
- )
253
- val defaultPushHandler = createDefaultPushHandler(
254
- onNotifiableEventsReceived = onNotifiableEventsReceived,
255
- notifiableEventsResult = notifiableEventResult,
256
- pushClientSecret = FakePushClientSecret (
257
- getUserIdFromSecretResult = { null }
258
- ),
259
- matrixAuthenticationService = FakeMatrixAuthenticationService ().apply {
260
- getLatestSessionIdLambda = { null }
261
- },
262
208
incrementPushCounterResult = incrementPushCounterResult,
263
209
pushHistoryService = pushHistoryService,
264
210
)
@@ -655,8 +601,8 @@ class DefaultPushHandlerTest {
655
601
var receivedFallbackEvent = false
656
602
val onPushReceivedResult =
657
603
lambdaRecorder<String , EventId ?, RoomId ?, SessionId ?, Boolean , Boolean , String ?, Unit > { _, _, _, _, isResolved, _, comment ->
658
- receivedFallbackEvent = ! isResolved && comment == " Unable to resolve event: ${aNotifiableFallbackEvent.cause} "
659
- }
604
+ receivedFallbackEvent = ! isResolved && comment == " Unable to resolve event: ${aNotifiableFallbackEvent.cause} "
605
+ }
660
606
val pushHistoryService = FakePushHistoryService (
661
607
onPushReceivedResult = onPushReceivedResult,
662
608
)
@@ -694,7 +640,6 @@ class DefaultPushHandlerTest {
694
640
userPushStore : UserPushStore = FakeUserPushStore (),
695
641
pushClientSecret : PushClientSecret = FakePushClientSecret (),
696
642
buildMeta : BuildMeta = aBuildMeta(),
697
- matrixAuthenticationService : MatrixAuthenticationService = FakeMatrixAuthenticationService (),
698
643
diagnosticPushHandler : DiagnosticPushHandler = DiagnosticPushHandler (),
699
644
elementCallEntryPoint : FakeElementCallEntryPoint = FakeElementCallEntryPoint (),
700
645
notificationChannels : FakeNotificationChannels = FakeNotificationChannels (),
@@ -712,7 +657,6 @@ class DefaultPushHandlerTest {
712
657
userPushStoreFactory = FakeUserPushStoreFactory { userPushStore },
713
658
pushClientSecret = pushClientSecret,
714
659
buildMeta = buildMeta,
715
- matrixAuthenticationService = matrixAuthenticationService,
716
660
diagnosticPushHandler = diagnosticPushHandler,
717
661
elementCallEntryPoint = elementCallEntryPoint,
718
662
notificationChannels = notificationChannels,
0 commit comments