From 82810f5248efef5a82ce23c4eca618971b153f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolf-Martell=20Montwe=CC=81?= Date: Thu, 25 May 2023 14:01:25 +0200 Subject: [PATCH] Fix failing tests --- feature/autodiscovery/autoconfig/build.gradle.kts | 1 + .../k9mail/autodiscovery/autoconfig/AutoconfigFetcherTest.kt | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/feature/autodiscovery/autoconfig/build.gradle.kts b/feature/autodiscovery/autoconfig/build.gradle.kts index 155e74b9d..41a44a1b3 100644 --- a/feature/autodiscovery/autoconfig/build.gradle.kts +++ b/feature/autodiscovery/autoconfig/build.gradle.kts @@ -11,6 +11,7 @@ dependencies { implementation(libs.minidns.hla) compileOnly(libs.xmlpull) + testImplementation(libs.kotlinx.coroutines.test) testImplementation(libs.kxml2) testImplementation(libs.jsoup) testImplementation(libs.okhttp.mockwebserver) diff --git a/feature/autodiscovery/autoconfig/src/test/kotlin/app/k9mail/autodiscovery/autoconfig/AutoconfigFetcherTest.kt b/feature/autodiscovery/autoconfig/src/test/kotlin/app/k9mail/autodiscovery/autoconfig/AutoconfigFetcherTest.kt index 9e713f4f3..03df86c09 100644 --- a/feature/autodiscovery/autoconfig/src/test/kotlin/app/k9mail/autodiscovery/autoconfig/AutoconfigFetcherTest.kt +++ b/feature/autodiscovery/autoconfig/src/test/kotlin/app/k9mail/autodiscovery/autoconfig/AutoconfigFetcherTest.kt @@ -4,6 +4,7 @@ import assertk.assertThat import assertk.assertions.isEqualTo import assertk.assertions.isNull import kotlin.test.assertNotNull +import kotlinx.coroutines.test.runTest import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.OkHttpClient import okhttp3.mockwebserver.MockResponse @@ -14,7 +15,7 @@ class AutoconfigFetcherTest { private val fetcher = AutoconfigFetcher(OkHttpClient.Builder().build()) @Test - fun shouldHandleNonexistentUrl() { + fun shouldHandleNonexistentUrl() = runTest { val nonExistentUrl = "https://autoconfig.domain.invalid/mail/config-v1.1.xml?emailaddress=test%40domain.example".toHttpUrl() @@ -24,7 +25,7 @@ class AutoconfigFetcherTest { } @Test - fun shouldHandleEmptyResponse() { + fun shouldHandleEmptyResponse() = runTest { val server = MockWebServer().apply { this.enqueue( MockResponse()