Create FakeIsPlayServiceAvailable
This commit is contained in:
parent
bfa238ba0d
commit
fbd0d397de
2 changed files with 26 additions and 10 deletions
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.libraries.pushproviders.firebase
|
||||||
|
|
||||||
|
class FakeIsPlayServiceAvailable(
|
||||||
|
private val isAvailable: Boolean,
|
||||||
|
) : IsPlayServiceAvailable {
|
||||||
|
override fun isAvailable() = isAvailable
|
||||||
|
}
|
||||||
|
|
@ -18,6 +18,7 @@ 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.IsPlayServiceAvailable
|
import io.element.android.libraries.pushproviders.firebase.IsPlayServiceAvailable
|
||||||
import io.element.android.libraries.troubleshoot.api.test.NotificationTroubleshootTestState
|
import io.element.android.libraries.troubleshoot.api.test.NotificationTroubleshootTestState
|
||||||
import io.element.android.services.toolbox.test.strings.FakeStringProvider
|
import io.element.android.services.toolbox.test.strings.FakeStringProvider
|
||||||
|
|
@ -29,11 +30,7 @@ class FirebaseAvailabilityTestTest {
|
||||||
@Test
|
@Test
|
||||||
fun `test FirebaseAvailabilityTest success`() = runTest {
|
fun `test FirebaseAvailabilityTest success`() = runTest {
|
||||||
val sut = FirebaseAvailabilityTest(
|
val sut = FirebaseAvailabilityTest(
|
||||||
isPlayServiceAvailable = object : IsPlayServiceAvailable {
|
isPlayServiceAvailable = FakeIsPlayServiceAvailable(true),
|
||||||
override fun isAvailable(): Boolean {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
stringProvider = FakeStringProvider(),
|
stringProvider = FakeStringProvider(),
|
||||||
)
|
)
|
||||||
launch {
|
launch {
|
||||||
|
|
@ -50,11 +47,7 @@ class FirebaseAvailabilityTestTest {
|
||||||
@Test
|
@Test
|
||||||
fun `test FirebaseAvailabilityTest failure`() = runTest {
|
fun `test FirebaseAvailabilityTest failure`() = runTest {
|
||||||
val sut = FirebaseAvailabilityTest(
|
val sut = FirebaseAvailabilityTest(
|
||||||
isPlayServiceAvailable = object : IsPlayServiceAvailable {
|
isPlayServiceAvailable = FakeIsPlayServiceAvailable(false),
|
||||||
override fun isAvailable(): Boolean {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
stringProvider = FakeStringProvider(),
|
stringProvider = FakeStringProvider(),
|
||||||
)
|
)
|
||||||
launch {
|
launch {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue