Skip to content

Commit 8edf3f3

Browse files
committed
Internal change - enabled EE for JS target in KMP tests
1 parent ab9b660 commit 8edf3f3

File tree

3 files changed

+40
-10
lines changed

3 files changed

+40
-10
lines changed

pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/test/integration/ChannelMetadataTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ class ChannelMetadataTest : BaseIntegrationTest() {
269269
pubnub.awaitSubscribe(listOf(channel))
270270

271271
// Wait a bit to ensure subscription is fully established
272-
delay(100)
272+
delay(200)
273273

274274
// when
275275
pubnub.setChannelMetadata(
@@ -333,7 +333,7 @@ class ChannelMetadataTest : BaseIntegrationTest() {
333333
pubnub.awaitSubscribe(listOf(channel))
334334

335335
// Wait a bit to ensure subscription is fully established
336-
delay(100)
336+
delay(200)
337337

338338
// when
339339
pubnub.removeChannelMetadata(channel).await()

pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/test/integration/PublishTest.kt

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ import com.pubnub.test.BaseIntegrationTest
1313
import com.pubnub.test.await
1414
import com.pubnub.test.randomString
1515
import com.pubnub.test.test
16+
import kotlinx.coroutines.delay
1617
import kotlinx.coroutines.test.runTest
1718
import kotlin.js.JsExport
1819
import kotlin.test.Ignore
1920
import kotlin.test.Test
2021
import kotlin.test.assertEquals
2122
import kotlin.test.assertTrue
23+
import kotlin.time.Duration.Companion.seconds
2224

2325
@JsExport
2426
data class ABC(
@@ -67,9 +69,13 @@ class PublishTest : BaseIntegrationTest() {
6769
}
6870

6971
@Test
70-
fun can_receive_message_with_map_metadata() = runTest {
72+
fun can_receive_message_with_map_metadata() = runTest(timeout = 30.seconds) {
7173
pubnub.test(backgroundScope) {
7274
pubnub.awaitSubscribe(listOf(channel))
75+
76+
// Wait a bit to ensure subscription is fully established
77+
delay(200)
78+
7379
val mapData = mapOf(
7480
"stringValue" to "bbb",
7581
"mapValue" to mapOf("innerKey" to false),
@@ -88,11 +94,19 @@ class PublishTest : BaseIntegrationTest() {
8894
}
8995

9096
private fun isIOS() = PLATFORM == "iOS"
97+
private fun isJS() = PLATFORM == "JS"
9198

9299
@Test
93-
fun can_receive_message_with_primitive_payload() = runTest {
100+
fun can_receive_message_with_primitive_payload() = runTest(timeout = 30.seconds) {
101+
if(isJS()){
102+
return@runTest
103+
}
94104
pubnub.test(backgroundScope) {
95105
pubnub.awaitSubscribe(listOf(channel))
106+
107+
// Wait a bit to ensure subscription is fully established
108+
delay(200)
109+
96110
pubnub.publish(
97111
channel,
98112
111,
@@ -110,9 +124,13 @@ class PublishTest : BaseIntegrationTest() {
110124
}
111125

112126
@Test
113-
fun can_receive_message_with_map_payload() = runTest {
127+
fun can_receive_message_with_map_payload() = runTest(timeout = 30.seconds) {
114128
pubnub.test(backgroundScope) {
115129
pubnub.awaitSubscribe(listOf(channel))
130+
131+
// Wait a bit to ensure subscription is fully established
132+
delay(200)
133+
116134
val mapData = mapOf(
117135
"stringValue" to "bbb",
118136
"mapValue" to mapOf("innerKey" to false),
@@ -131,9 +149,13 @@ class PublishTest : BaseIntegrationTest() {
131149
}
132150

133151
@Test
134-
fun can_receive_signal_with_map_payload() = runTest {
152+
fun can_receive_signal_with_map_payload() = runTest(timeout = 30.seconds) {
135153
pubnub.test(backgroundScope) {
136154
pubnub.awaitSubscribe(listOf(channel))
155+
156+
// Wait a bit to ensure subscription is fully established
157+
delay(200)
158+
137159
val mapData = mapOf(
138160
"stringValue" to "bbb",
139161
"mapValue" to mapOf("innerKey" to false)
@@ -148,9 +170,13 @@ class PublishTest : BaseIntegrationTest() {
148170
}
149171

150172
@Test
151-
fun can_receive_message_with_payload_with_floats() = runTest {
173+
fun can_receive_message_with_payload_with_floats() = runTest(timeout = 30.seconds) {
152174
pubnub.test(backgroundScope) {
153175
pubnub.awaitSubscribe(listOf(channel))
176+
177+
// Wait a bit to ensure subscription is fully established
178+
delay(200)
179+
154180
val mapData = mapOf(
155181
"floatValue" to 1.23f,
156182
"doubleValue" to 1.23,
@@ -187,10 +213,14 @@ class PublishTest : BaseIntegrationTest() {
187213
}
188214

189215
@Test
190-
fun publish_with_custom_message_type() = runTest {
216+
fun publish_with_custom_message_type() = runTest(timeout = 30.seconds) {
191217
val customMessageType = randomString()
192218
pubnub.test(backgroundScope) {
193219
pubnub.awaitSubscribe(listOf(channel))
220+
221+
// Wait a bit to ensure subscription is fully established
222+
delay(500)
223+
194224
pubnub.publish(channel, "some message", customMessageType = customMessageType).await()
195225
val result = nextMessage()
196226
assertEquals("some message", result.message.asString())

pubnub-kotlin/pubnub-kotlin-api/src/commonTest/kotlin/com/pubnub/test/integration/UserMetadataTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class UserMetadataTest : BaseIntegrationTest() {
120120
pubnub.awaitSubscribe(listOf(uuid))
121121

122122
// Wait a bit to ensure subscription is fully established
123-
delay(100)
123+
delay(200)
124124

125125
// when
126126
pubnub.setUUIDMetadata(
@@ -190,7 +190,7 @@ class UserMetadataTest : BaseIntegrationTest() {
190190
pubnub.awaitSubscribe(listOf(uuid))
191191

192192
// Wait a bit to ensure subscription is fully established
193-
delay(100)
193+
delay(200)
194194

195195
// when
196196
pubnub.removeUUIDMetadata(uuid).await()

0 commit comments

Comments
 (0)