mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Fix test on UtdTrackerTest
This commit is contained in:
+15
-2
@@ -22,13 +22,20 @@ import io.element.android.libraries.matrix.test.AN_EVENT_ID
|
|||||||
import io.element.android.services.analytics.test.FakeAnalyticsService
|
import io.element.android.services.analytics.test.FakeAnalyticsService
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.matrix.rustcomponents.sdk.UnableToDecryptInfo
|
import org.matrix.rustcomponents.sdk.UnableToDecryptInfo
|
||||||
|
import uniffi.matrix_sdk_crypto.UtdCause
|
||||||
|
|
||||||
class UtdTrackerTest {
|
class UtdTrackerTest {
|
||||||
@Test
|
@Test
|
||||||
fun `when onUtd is called with null timeToDecryptMs, the expected analytics Event is sent`() {
|
fun `when onUtd is called with null timeToDecryptMs, the expected analytics Event is sent`() {
|
||||||
val fakeAnalyticsService = FakeAnalyticsService()
|
val fakeAnalyticsService = FakeAnalyticsService()
|
||||||
val sut = UtdTracker(fakeAnalyticsService)
|
val sut = UtdTracker(fakeAnalyticsService)
|
||||||
sut.onUtd(UnableToDecryptInfo(eventId = AN_EVENT_ID.value, timeToDecryptMs = null))
|
sut.onUtd(
|
||||||
|
UnableToDecryptInfo(
|
||||||
|
eventId = AN_EVENT_ID.value,
|
||||||
|
timeToDecryptMs = null,
|
||||||
|
cause = UtdCause.UNKNOWN,
|
||||||
|
)
|
||||||
|
)
|
||||||
assertThat(fakeAnalyticsService.capturedEvents).containsExactly(
|
assertThat(fakeAnalyticsService.capturedEvents).containsExactly(
|
||||||
Error(
|
Error(
|
||||||
context = null,
|
context = null,
|
||||||
@@ -47,7 +54,13 @@ class UtdTrackerTest {
|
|||||||
fun `when onUtd is called with timeToDecryptMs, the expected analytics Event is sent`() {
|
fun `when onUtd is called with timeToDecryptMs, the expected analytics Event is sent`() {
|
||||||
val fakeAnalyticsService = FakeAnalyticsService()
|
val fakeAnalyticsService = FakeAnalyticsService()
|
||||||
val sut = UtdTracker(fakeAnalyticsService)
|
val sut = UtdTracker(fakeAnalyticsService)
|
||||||
sut.onUtd(UnableToDecryptInfo(eventId = AN_EVENT_ID.value, timeToDecryptMs = 123.toULong()))
|
sut.onUtd(
|
||||||
|
UnableToDecryptInfo(
|
||||||
|
eventId = AN_EVENT_ID.value,
|
||||||
|
timeToDecryptMs = 123.toULong(),
|
||||||
|
cause = UtdCause.UNKNOWN,
|
||||||
|
)
|
||||||
|
)
|
||||||
assertThat(fakeAnalyticsService.capturedEvents).containsExactly(
|
assertThat(fakeAnalyticsService.capturedEvents).containsExactly(
|
||||||
Error(
|
Error(
|
||||||
context = null,
|
context = null,
|
||||||
|
|||||||
Reference in New Issue
Block a user