mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-06 16:43:43 +00:00
Extract UnableToDecryptInfo constructor invocation to a factory.
This commit is contained in:
+6
-6
@@ -9,10 +9,10 @@ package io.element.android.libraries.matrix.impl.analytics
|
|||||||
|
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import im.vector.app.features.analytics.plan.Error
|
import im.vector.app.features.analytics.plan.Error
|
||||||
|
import io.element.android.libraries.matrix.impl.fixtures.factories.aRustUnableToDecryptInfo
|
||||||
import io.element.android.libraries.matrix.test.AN_EVENT_ID
|
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 uniffi.matrix_sdk_crypto.UtdCause
|
import uniffi.matrix_sdk_crypto.UtdCause
|
||||||
|
|
||||||
class UtdTrackerTest {
|
class UtdTrackerTest {
|
||||||
@@ -21,7 +21,7 @@ class UtdTrackerTest {
|
|||||||
val fakeAnalyticsService = FakeAnalyticsService()
|
val fakeAnalyticsService = FakeAnalyticsService()
|
||||||
val sut = UtdTracker(fakeAnalyticsService)
|
val sut = UtdTracker(fakeAnalyticsService)
|
||||||
sut.onUtd(
|
sut.onUtd(
|
||||||
UnableToDecryptInfo(
|
aRustUnableToDecryptInfo(
|
||||||
eventId = AN_EVENT_ID.value,
|
eventId = AN_EVENT_ID.value,
|
||||||
timeToDecryptMs = null,
|
timeToDecryptMs = null,
|
||||||
cause = UtdCause.UNKNOWN,
|
cause = UtdCause.UNKNOWN,
|
||||||
@@ -46,7 +46,7 @@ class UtdTrackerTest {
|
|||||||
val fakeAnalyticsService = FakeAnalyticsService()
|
val fakeAnalyticsService = FakeAnalyticsService()
|
||||||
val sut = UtdTracker(fakeAnalyticsService)
|
val sut = UtdTracker(fakeAnalyticsService)
|
||||||
sut.onUtd(
|
sut.onUtd(
|
||||||
UnableToDecryptInfo(
|
aRustUnableToDecryptInfo(
|
||||||
eventId = AN_EVENT_ID.value,
|
eventId = AN_EVENT_ID.value,
|
||||||
timeToDecryptMs = 123.toULong(),
|
timeToDecryptMs = 123.toULong(),
|
||||||
cause = UtdCause.UNKNOWN,
|
cause = UtdCause.UNKNOWN,
|
||||||
@@ -71,7 +71,7 @@ class UtdTrackerTest {
|
|||||||
val fakeAnalyticsService = FakeAnalyticsService()
|
val fakeAnalyticsService = FakeAnalyticsService()
|
||||||
val sut = UtdTracker(fakeAnalyticsService)
|
val sut = UtdTracker(fakeAnalyticsService)
|
||||||
sut.onUtd(
|
sut.onUtd(
|
||||||
UnableToDecryptInfo(
|
aRustUnableToDecryptInfo(
|
||||||
eventId = AN_EVENT_ID.value,
|
eventId = AN_EVENT_ID.value,
|
||||||
timeToDecryptMs = 123.toULong(),
|
timeToDecryptMs = 123.toULong(),
|
||||||
cause = UtdCause.SENT_BEFORE_WE_JOINED,
|
cause = UtdCause.SENT_BEFORE_WE_JOINED,
|
||||||
@@ -96,7 +96,7 @@ class UtdTrackerTest {
|
|||||||
val fakeAnalyticsService = FakeAnalyticsService()
|
val fakeAnalyticsService = FakeAnalyticsService()
|
||||||
val sut = UtdTracker(fakeAnalyticsService)
|
val sut = UtdTracker(fakeAnalyticsService)
|
||||||
sut.onUtd(
|
sut.onUtd(
|
||||||
UnableToDecryptInfo(
|
aRustUnableToDecryptInfo(
|
||||||
eventId = AN_EVENT_ID.value,
|
eventId = AN_EVENT_ID.value,
|
||||||
timeToDecryptMs = 123.toULong(),
|
timeToDecryptMs = 123.toULong(),
|
||||||
cause = UtdCause.UNSIGNED_DEVICE,
|
cause = UtdCause.UNSIGNED_DEVICE,
|
||||||
@@ -119,7 +119,7 @@ class UtdTrackerTest {
|
|||||||
val fakeAnalyticsService = FakeAnalyticsService()
|
val fakeAnalyticsService = FakeAnalyticsService()
|
||||||
val sut = UtdTracker(fakeAnalyticsService)
|
val sut = UtdTracker(fakeAnalyticsService)
|
||||||
sut.onUtd(
|
sut.onUtd(
|
||||||
UnableToDecryptInfo(
|
aRustUnableToDecryptInfo(
|
||||||
eventId = AN_EVENT_ID.value,
|
eventId = AN_EVENT_ID.value,
|
||||||
timeToDecryptMs = 123.toULong(),
|
timeToDecryptMs = 123.toULong(),
|
||||||
cause = UtdCause.VERIFICATION_VIOLATION,
|
cause = UtdCause.VERIFICATION_VIOLATION,
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2024 New Vector Ltd.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
* Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.libraries.matrix.impl.fixtures.factories
|
||||||
|
|
||||||
|
import org.matrix.rustcomponents.sdk.UnableToDecryptInfo
|
||||||
|
import uniffi.matrix_sdk_crypto.UtdCause
|
||||||
|
|
||||||
|
internal fun aRustUnableToDecryptInfo(
|
||||||
|
eventId: String,
|
||||||
|
timeToDecryptMs: ULong?,
|
||||||
|
cause: UtdCause,
|
||||||
|
): UnableToDecryptInfo {
|
||||||
|
return UnableToDecryptInfo(
|
||||||
|
eventId = eventId,
|
||||||
|
timeToDecryptMs = timeToDecryptMs,
|
||||||
|
cause = cause,
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user