mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Add test on isRelevant
This commit is contained in:
+12
@@ -19,7 +19,9 @@ package io.element.android.libraries.pushproviders.firebase.troubleshoot
|
|||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import io.element.android.libraries.pushproviders.firebase.FakeIsPlayServiceAvailable
|
import io.element.android.libraries.pushproviders.firebase.FakeIsPlayServiceAvailable
|
||||||
|
import io.element.android.libraries.pushproviders.firebase.FirebaseConfig
|
||||||
import io.element.android.libraries.troubleshoot.api.test.NotificationTroubleshootTestState
|
import io.element.android.libraries.troubleshoot.api.test.NotificationTroubleshootTestState
|
||||||
|
import io.element.android.libraries.troubleshoot.api.test.TestFilterData
|
||||||
import io.element.android.services.toolbox.test.strings.FakeStringProvider
|
import io.element.android.services.toolbox.test.strings.FakeStringProvider
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
@@ -59,4 +61,14 @@ class FirebaseAvailabilityTestTest {
|
|||||||
assertThat(lastItem.status).isEqualTo(NotificationTroubleshootTestState.Status.Failure(false))
|
assertThat(lastItem.status).isEqualTo(NotificationTroubleshootTestState.Status.Failure(false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test FirebaseAvailabilityTest isRelevant`() {
|
||||||
|
val sut = FirebaseAvailabilityTest(
|
||||||
|
isPlayServiceAvailable = FakeIsPlayServiceAvailable(false),
|
||||||
|
stringProvider = FakeStringProvider(),
|
||||||
|
)
|
||||||
|
assertThat(sut.isRelevant(TestFilterData(currentPushProviderName = "unknown"))).isFalse()
|
||||||
|
assertThat(sut.isRelevant(TestFilterData(currentPushProviderName = FirebaseConfig.NAME))).isTrue()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
@@ -19,8 +19,10 @@ package io.element.android.libraries.pushproviders.firebase.troubleshoot
|
|||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import io.element.android.libraries.pushproviders.firebase.FakeFirebaseTroubleshooter
|
import io.element.android.libraries.pushproviders.firebase.FakeFirebaseTroubleshooter
|
||||||
|
import io.element.android.libraries.pushproviders.firebase.FirebaseConfig
|
||||||
import io.element.android.libraries.pushproviders.firebase.InMemoryFirebaseStore
|
import io.element.android.libraries.pushproviders.firebase.InMemoryFirebaseStore
|
||||||
import io.element.android.libraries.troubleshoot.api.test.NotificationTroubleshootTestState
|
import io.element.android.libraries.troubleshoot.api.test.NotificationTroubleshootTestState
|
||||||
|
import io.element.android.libraries.troubleshoot.api.test.TestFilterData
|
||||||
import io.element.android.services.toolbox.test.strings.FakeStringProvider
|
import io.element.android.services.toolbox.test.strings.FakeStringProvider
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
@@ -75,6 +77,17 @@ class FirebaseTokenTestTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test FirebaseTokenTest isRelevant`() {
|
||||||
|
val sut = FirebaseTokenTest(
|
||||||
|
firebaseStore = InMemoryFirebaseStore(null),
|
||||||
|
firebaseTroubleshooter = FakeFirebaseTroubleshooter(),
|
||||||
|
stringProvider = FakeStringProvider(),
|
||||||
|
)
|
||||||
|
assertThat(sut.isRelevant(TestFilterData(currentPushProviderName = "unknown"))).isFalse()
|
||||||
|
assertThat(sut.isRelevant(TestFilterData(currentPushProviderName = FirebaseConfig.NAME))).isTrue()
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val FAKE_TOKEN = "abcdefghijk"
|
private const val FAKE_TOKEN = "abcdefghijk"
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -85,7 +85,7 @@ class UnifiedPushTestTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test isRelevant`() = runTest {
|
fun `test isRelevant`() {
|
||||||
val sut = UnifiedPushTest(
|
val sut = UnifiedPushTest(
|
||||||
unifiedPushDistributorProvider = FakeUnifiedPushDistributorProvider(),
|
unifiedPushDistributorProvider = FakeUnifiedPushDistributorProvider(),
|
||||||
openDistributorWebPageAction = FakeOpenDistributorWebPageAction(),
|
openDistributorWebPageAction = FakeOpenDistributorWebPageAction(),
|
||||||
|
|||||||
Reference in New Issue
Block a user