Fixes test cases

This commit is contained in:
Vitor Pamplona
2026-04-28 17:50:21 -04:00
parent b81bebf6bb
commit de773d06f9
9 changed files with 22 additions and 11 deletions
@@ -25,6 +25,7 @@ import com.vitorpamplona.nestsclient.OkHttpNestsClient
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal
import kotlinx.coroutines.runBlocking
import okhttp3.OkHttpClient
import org.junit.AfterClass
import org.junit.BeforeClass
import org.junit.Test
@@ -41,6 +42,8 @@ import kotlin.test.assertTrue
* Skipped by default — set `-DnestsInterop=true` to enable.
*/
class NostrNestsAuthInteropTest {
val client = OkHttpNestsClient { OkHttpClient() }
@Test
fun production_OkHttpNestsClient_mints_a_jwt_against_real_moq_auth() =
runBlocking {
@@ -48,7 +51,7 @@ class NostrNestsAuthInteropTest {
val harness = harnessOrNull ?: return@runBlocking
val signer = NostrSignerInternal(KeyPair())
val client = OkHttpNestsClient()
val room =
NestsRoomConfig(
authBaseUrl = harness.authBaseUrl,
@@ -38,6 +38,7 @@ import kotlinx.coroutines.flow.take
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeoutOrNull
import okhttp3.OkHttpClient
import org.junit.AfterClass
import org.junit.BeforeClass
import org.junit.Test
@@ -178,7 +179,7 @@ class NostrNestsLateJoinInteropTest {
private const val FRAME_SPACING_MS = 25L
private const val RECEIVE_TIMEOUT_MS = 10_000L
private val httpClient = OkHttpNestsClient()
private val httpClient = OkHttpNestsClient { OkHttpClient() }
private val transport =
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
private var harnessOrNull: NostrNestsHarness? = null
@@ -46,6 +46,7 @@ import kotlinx.coroutines.flow.take
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeoutOrNull
import okhttp3.OkHttpClient
import org.junit.AfterClass
import org.junit.BeforeClass
import org.junit.Test
@@ -452,7 +453,7 @@ class NostrNestsMultiPeerInteropTest {
private const val FRAME_SPACING_MS = 25L
private const val RECEIVE_TIMEOUT_MS = 15_000L
private val http = OkHttpNestsClient()
private val http = OkHttpNestsClient { OkHttpClient() }
private val transport =
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
private var harnessOrNull: NostrNestsHarness? = null
@@ -38,6 +38,7 @@ import kotlinx.coroutines.flow.take
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeoutOrNull
import okhttp3.OkHttpClient
import org.junit.AfterClass
import org.junit.BeforeClass
import org.junit.Test
@@ -174,7 +175,7 @@ class NostrNestsMuteInteropTest {
private const val MUTE_BOUNDARY_MS = 200L
private const val RECEIVE_TIMEOUT_MS = 10_000L
private val httpClient = OkHttpNestsClient()
private val httpClient = OkHttpNestsClient { OkHttpClient() }
private val transport =
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
private var harnessOrNull: NostrNestsHarness? = null
@@ -48,6 +48,7 @@ import kotlinx.coroutines.flow.take
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeoutOrNull
import okhttp3.OkHttpClient
import org.junit.AfterClass
import org.junit.BeforeClass
import org.junit.Test
@@ -94,7 +95,7 @@ class NostrNestsReconnectingListenerInteropTest {
roomId = "rec-${System.currentTimeMillis()}",
)
val httpClient = OkHttpNestsClient()
val httpClient = OkHttpNestsClient { OkHttpClient() }
val transport =
QuicWebTransportFactory(
certificateValidator = PermissiveCertificateValidator(),
@@ -213,7 +214,7 @@ class NostrNestsReconnectingListenerInteropTest {
roomId = "swap-${System.currentTimeMillis()}",
)
val httpClient = OkHttpNestsClient()
val httpClient = OkHttpNestsClient { OkHttpClient() }
val transport =
QuicWebTransportFactory(
certificateValidator = PermissiveCertificateValidator(),
@@ -450,7 +451,7 @@ class NostrNestsReconnectingListenerInteropTest {
roomId = "lst-pub-cycle-${System.currentTimeMillis()}",
)
val httpClient = OkHttpNestsClient()
val httpClient = OkHttpNestsClient { OkHttpClient() }
val transport =
QuicWebTransportFactory(
certificateValidator = PermissiveCertificateValidator(),
@@ -47,6 +47,7 @@ import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeoutOrNull
import okhttp3.OkHttpClient
import org.junit.AfterClass
import org.junit.BeforeClass
import org.junit.Test
@@ -220,7 +221,7 @@ class NostrNestsReconnectingSpeakerInteropTest {
roomId = "spk-refr-${System.currentTimeMillis()}",
)
val httpClient = OkHttpNestsClient()
val httpClient = OkHttpNestsClient { OkHttpClient() }
val transport =
QuicWebTransportFactory(
certificateValidator = PermissiveCertificateValidator(),
@@ -43,6 +43,7 @@ import kotlinx.coroutines.flow.take
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeoutOrNull
import okhttp3.OkHttpClient
import org.junit.AfterClass
import org.junit.BeforeClass
import org.junit.Test
@@ -99,7 +100,7 @@ class NostrNestsRoundTripInteropTest {
roomId = "rt-${System.currentTimeMillis()}",
)
val httpClient = OkHttpNestsClient()
val httpClient = OkHttpNestsClient { OkHttpClient() }
// Self-signed dev cert on the relay — production uses
// JdkCertificateValidator; the type system forces us to pass a
// permissive validator explicitly here.
@@ -37,6 +37,7 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeoutOrNull
import okhttp3.OkHttpClient
import org.junit.AfterClass
import org.junit.BeforeClass
import org.junit.Test
@@ -186,7 +187,7 @@ class NostrNestsSpeakerCloseInteropTest {
private const val FRAME_SPACING_MS = 25L
private const val CLOSE_TIMEOUT_MS = 5_000L
private val httpClient = OkHttpNestsClient()
private val httpClient = OkHttpNestsClient { OkHttpClient() }
private val transport =
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
private var harnessOrNull: NostrNestsHarness? = null
@@ -38,6 +38,7 @@ import kotlinx.coroutines.flow.take
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeoutOrNull
import okhttp3.OkHttpClient
import org.junit.AfterClass
import org.junit.BeforeClass
import org.junit.Test
@@ -175,7 +176,7 @@ class NostrNestsUnsubscribeInteropTest {
private const val FRAME_SPACING_MS = 25L
private const val RECEIVE_TIMEOUT_MS = 10_000L
private val httpClient = OkHttpNestsClient()
private val httpClient = OkHttpNestsClient { OkHttpClient() }
private val transport =
QuicWebTransportFactory(certificateValidator = PermissiveCertificateValidator())
private var harnessOrNull: NostrNestsHarness? = null