From de773d06f95753c445a4fb4f196d73a6096ec80e Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Tue, 28 Apr 2026 17:50:21 -0400 Subject: [PATCH] Fixes test cases --- .../nestsclient/interop/NostrNestsAuthInteropTest.kt | 5 ++++- .../nestsclient/interop/NostrNestsLateJoinInteropTest.kt | 3 ++- .../nestsclient/interop/NostrNestsMultiPeerInteropTest.kt | 3 ++- .../nestsclient/interop/NostrNestsMuteInteropTest.kt | 3 ++- .../interop/NostrNestsReconnectingListenerInteropTest.kt | 7 ++++--- .../interop/NostrNestsReconnectingSpeakerInteropTest.kt | 3 ++- .../nestsclient/interop/NostrNestsRoundTripInteropTest.kt | 3 ++- .../interop/NostrNestsSpeakerCloseInteropTest.kt | 3 ++- .../interop/NostrNestsUnsubscribeInteropTest.kt | 3 ++- 9 files changed, 22 insertions(+), 11 deletions(-) diff --git a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsAuthInteropTest.kt b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsAuthInteropTest.kt index 9eb5390e1..cdf3260b1 100644 --- a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsAuthInteropTest.kt +++ b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsAuthInteropTest.kt @@ -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, diff --git a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsLateJoinInteropTest.kt b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsLateJoinInteropTest.kt index 90f07837c..49033cedf 100644 --- a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsLateJoinInteropTest.kt +++ b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsLateJoinInteropTest.kt @@ -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 diff --git a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsMultiPeerInteropTest.kt b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsMultiPeerInteropTest.kt index ce7a29109..01a47ea4d 100644 --- a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsMultiPeerInteropTest.kt +++ b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsMultiPeerInteropTest.kt @@ -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 diff --git a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsMuteInteropTest.kt b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsMuteInteropTest.kt index c12b6b633..4ed587db7 100644 --- a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsMuteInteropTest.kt +++ b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsMuteInteropTest.kt @@ -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 diff --git a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsReconnectingListenerInteropTest.kt b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsReconnectingListenerInteropTest.kt index 724482d72..88e296422 100644 --- a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsReconnectingListenerInteropTest.kt +++ b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsReconnectingListenerInteropTest.kt @@ -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(), diff --git a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsReconnectingSpeakerInteropTest.kt b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsReconnectingSpeakerInteropTest.kt index a579c45f0..2c351bb23 100644 --- a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsReconnectingSpeakerInteropTest.kt +++ b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsReconnectingSpeakerInteropTest.kt @@ -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(), diff --git a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsRoundTripInteropTest.kt b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsRoundTripInteropTest.kt index 2dd29ed29..e194b7e0f 100644 --- a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsRoundTripInteropTest.kt +++ b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsRoundTripInteropTest.kt @@ -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. diff --git a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsSpeakerCloseInteropTest.kt b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsSpeakerCloseInteropTest.kt index b9ef87ad2..c52ccebb0 100644 --- a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsSpeakerCloseInteropTest.kt +++ b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsSpeakerCloseInteropTest.kt @@ -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 diff --git a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsUnsubscribeInteropTest.kt b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsUnsubscribeInteropTest.kt index a65bbe781..1840f6b50 100644 --- a/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsUnsubscribeInteropTest.kt +++ b/nestsClient/src/jvmTest/kotlin/com/vitorpamplona/nestsclient/interop/NostrNestsUnsubscribeInteropTest.kt @@ -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