Revert runTest because the wait to get results back fails in the function
This commit is contained in:
+1
-1
@@ -103,7 +103,7 @@ suspend fun INostrClient.sendAndWaitForResponse(
|
|||||||
val currentResult = receivedResults[result.relay]
|
val currentResult = receivedResults[result.relay]
|
||||||
// do not override a successful result.
|
// do not override a successful result.
|
||||||
if (currentResult == null || !currentResult) {
|
if (currentResult == null || !currentResult) {
|
||||||
receivedResults.put(result.relay, result.success)
|
receivedResults[result.relay] = result.success
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -30,14 +30,14 @@ import kotlinx.coroutines.CoroutineScope
|
|||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.SupervisorJob
|
import kotlinx.coroutines.SupervisorJob
|
||||||
import kotlinx.coroutines.cancel
|
import kotlinx.coroutines.cancel
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
class NostrClientSendAndWaitTest : BaseNostrClientTest() {
|
class NostrClientSendAndWaitTest : BaseNostrClientTest() {
|
||||||
@Test
|
@Test
|
||||||
fun testSendAndWaitForResponse() =
|
fun testSendAndWaitForResponse() =
|
||||||
runTest {
|
runBlocking {
|
||||||
val appScope = CoroutineScope(Dispatchers.Default + SupervisorJob())
|
val appScope = CoroutineScope(Dispatchers.Default + SupervisorJob())
|
||||||
val client = NostrClient(socketBuilder, appScope)
|
val client = NostrClient(socketBuilder, appScope)
|
||||||
|
|
||||||
@@ -61,6 +61,6 @@ class NostrClientSendAndWaitTest : BaseNostrClientTest() {
|
|||||||
appScope.cancel()
|
appScope.cancel()
|
||||||
|
|
||||||
assertEquals(true, resultDamus)
|
assertEquals(true, resultDamus)
|
||||||
assertEquals(false, resultNos)
|
assertEquals(true, resultNos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user