File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2025 New Vector Ltd.
3
+ *
4
+ * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5
+ * Please see LICENSE files in the repository root for full details.
6
+ */
7
+
8
+ package io.element.android.features.rageshake.impl
9
+
10
+ import app.cash.turbine.test
11
+ import com.google.common.truth.Truth.assertThat
12
+ import kotlinx.coroutines.flow.MutableStateFlow
13
+ import kotlinx.coroutines.test.runTest
14
+ import okhttp3.HttpUrl
15
+ import okhttp3.HttpUrl.Companion.toHttpUrl
16
+ import org.junit.Test
17
+
18
+ class DefaultRageshakeFeatureAvailabilityTest {
19
+ @Test
20
+ fun `test isAvailable returns true when bug reporter URL is provided` () = runTest {
21
+ val flow = MutableStateFlow <HttpUrl ?>(null )
22
+ val sut = DefaultRageshakeFeatureAvailability (
23
+ bugReporterUrlProvider = { flow },
24
+ )
25
+ sut.isAvailable().test {
26
+ assertThat(awaitItem()).isFalse()
27
+ flow.value = " https://example.com/bugreport" .toHttpUrl()
28
+ assertThat(awaitItem()).isTrue()
29
+ flow.value = null
30
+ assertThat(awaitItem()).isFalse()
31
+ }
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments