Skip to content

Commit

Permalink
[JS] Fix getMemberships ignoring uuid parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
wkal-pubnub committed Nov 6, 2024
1 parent 11634e5 commit c53a53f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
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 @@ -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

0 comments on commit c53a53f

Please sign in to comment.