mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Fix tests.
This commit is contained in:
+17
-8
@@ -11,16 +11,19 @@ import app.cash.turbine.test
|
|||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import io.element.android.appconfig.RageshakeConfig
|
import io.element.android.appconfig.RageshakeConfig
|
||||||
import io.element.android.features.enterprise.api.BugReportUrl
|
import io.element.android.features.enterprise.api.BugReportUrl
|
||||||
|
import io.element.android.features.enterprise.api.EnterpriseService
|
||||||
import io.element.android.features.enterprise.test.FakeEnterpriseService
|
import io.element.android.features.enterprise.test.FakeEnterpriseService
|
||||||
|
import io.element.android.libraries.sessionstorage.api.SessionStore
|
||||||
|
import io.element.android.libraries.sessionstorage.test.InMemorySessionStore
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class DefaultBugReporterUrlProviderTest {
|
class DefaultBugReporterUrlProviderTest {
|
||||||
@Test
|
@Test
|
||||||
fun `provide return values when there is an rageshake app name`() = runTest {
|
fun `provide returns values when there is an rageshake app name`() = runTest {
|
||||||
val enterpriseService = FakeEnterpriseService()
|
val enterpriseService = FakeEnterpriseService()
|
||||||
val sut = DefaultBugReporterUrlProvider(
|
val sut = createDefaultBugReporterUrlProvider(
|
||||||
bugReportAppNameProvider = { "rageshakeAppName" },
|
bugReportAppNameProvider = { "rageshakeAppName" },
|
||||||
enterpriseService = enterpriseService,
|
enterpriseService = enterpriseService,
|
||||||
)
|
)
|
||||||
@@ -36,15 +39,21 @@ class DefaultBugReporterUrlProviderTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `provide return null when there is no rageshake app name`() = runTest {
|
fun `provide returns null when there is no rageshake app name`() = runTest {
|
||||||
val enterpriseService = FakeEnterpriseService()
|
val sut = createDefaultBugReporterUrlProvider()
|
||||||
val sut = DefaultBugReporterUrlProvider(
|
|
||||||
bugReportAppNameProvider = { "" },
|
|
||||||
enterpriseService = enterpriseService,
|
|
||||||
)
|
|
||||||
sut.provide().test {
|
sut.provide().test {
|
||||||
assertThat(awaitItem()).isNull()
|
assertThat(awaitItem()).isNull()
|
||||||
awaitComplete()
|
awaitComplete()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun createDefaultBugReporterUrlProvider(
|
||||||
|
bugReportAppNameProvider: BugReportAppNameProvider = BugReportAppNameProvider { "" },
|
||||||
|
enterpriseService: EnterpriseService = FakeEnterpriseService(),
|
||||||
|
sessionStore: SessionStore = InMemorySessionStore(),
|
||||||
|
) = DefaultBugReporterUrlProvider(
|
||||||
|
bugReportAppNameProvider = bugReportAppNameProvider,
|
||||||
|
enterpriseService = enterpriseService,
|
||||||
|
sessionStore = sessionStore,
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user