Fix tests.
This commit is contained in:
parent
e7f6a1a5e6
commit
1587ed5fe2
1 changed files with 17 additions and 8 deletions
|
|
@ -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,
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue