Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JS] Fix getMemberships ignoring uuid parameter #306

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ class MembershipsTest : BaseIntegrationTest() {
assertEquals(customData, pnChannelDetails.custom?.value)
}

@Test
fun can_set_and_get_memberships_for_other_uuid() = runTest {
// when
val userId = "some-user-" + randomString()
pubnub.setMemberships(
channels = listOf(PNChannelMembership.Partial(channel, custom, status)),
uuid = userId,
includeCustom = includeCustom,
includeChannelDetails = PNChannelDetailsLevel.CHANNEL_WITH_CUSTOM,
).await()

val result = pubnub.getMemberships(uuid = userId, filter = "channel.id == '$channel'", includeCustom = true).await()

// then
val pnChannelDetails = result.data.single { it.channel.id == channel }
assertEquals(channel, pnChannelDetails.channel.id)
assertEquals(customData, pnChannelDetails.custom?.value)
}

@Test
fun can_receive_set_membership_event() = runTest {
pubnub.test(backgroundScope) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.pubnub.api.models.consumer.pubsub.PNSignalResult
import com.pubnub.kmp.PLATFORM
import com.pubnub.test.BaseIntegrationTest
import com.pubnub.test.await
import com.pubnub.test.randomString
import com.pubnub.test.test
import kotlinx.coroutines.test.runTest
import kotlin.js.JsExport
Expand All @@ -27,7 +28,7 @@ data class ABC(
)

class PublishTest : BaseIntegrationTest() {
private val channel = "myChannel"
private val channel = "myChannel" + randomString()

@Test
fun can_publish_message_string() =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
return GetMembershipsImpl(
jsPubNub,
createJsObject {
uuid?.let { this.uuid = it }
this.sort = sort.toJsMap()
this.filter = filter
this.page = page.toMetadataPage()
Expand Down
Loading