Skip to content

Commit

Permalink
Fix IPAddressTest.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
w2sv committed Nov 24, 2024
1 parent 23e41b1 commit 099c139
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@ package com.w2sv.networking.model
import kotlinx.coroutines.test.runTest
import okhttp3.OkHttpClient
import org.junit.Test
import kotlin.test.assertTrue

class IPAddressTest {

@Test
fun `test fetchPublic`() {
val httpClient = OkHttpClient()
runTest {
IPAddress.fetchPublic(httpClient, IPAddress.Version.V4).getOrThrow()
IPAddress.fetchPublic(httpClient, IPAddress.Version.V6).getOrThrow()
val v4FetchResult = IPAddress.fetchPublic(httpClient, IPAddress.Version.V4)
val v6FetchResult = IPAddress.fetchPublic(httpClient, IPAddress.Version.V6)

assertTrue(
v4FetchResult.isSuccess || v6FetchResult.isSuccess,
"Fetching of both IP versions failed with ${v4FetchResult.exceptionOrNull()} and ${v6FetchResult.exceptionOrNull()}"
)
}
}
}

0 comments on commit 099c139

Please sign in to comment.