Add test on isRelevant
This commit is contained in:
parent
0d445cdeb3
commit
5b8c0871e8
3 changed files with 26 additions and 1 deletions
|
|
@ -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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue