Skip to content

Commit

Permalink
Fix lint.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-cebo committed Dec 2, 2024
1 parent 695e973 commit b0f6ce0
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal class PNMembersConverterTest {
@Test
fun from() {
val member = PNMember(
PNUUIDMetadata(
uuid = PNUUIDMetadata(
randomString(),
PatchValue.of(randomString()),
PatchValue.of(randomString()),
Expand All @@ -21,10 +21,11 @@ internal class PNMembersConverterTest {
PatchValue.of(mapOf(randomString() to randomString())),
PatchValue.of(randomString()),
),
PatchValue.of(mapOf(randomString() to randomString())),
randomString(),
randomString(),
PatchValue.of(randomString())
custom = PatchValue.of(mapOf(randomString() to randomString())),
updated = randomString(),
eTag = randomString(),
status = PatchValue.of(randomString()),
type = PatchValue.of(randomString())
)
val actual = PNMembersConverter.from(member)
assertEquals(member, actual!!)
Expand All @@ -46,7 +47,8 @@ internal class PNMembersConverterTest {
PatchValue.of(mapOf(randomString() to randomString())),
randomString(),
randomString(),
PatchValue.of(randomString())
status = PatchValue.of(randomString()),
type = PatchValue.of(randomString())
)
}
val actualList = PNMembersConverter.from(items)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ internal class DelegatingEventListenerTest {
pn,
PNObjectEventResult(
BasePubSubResult("a", "b", 0L, null, null),
PNSetMembershipEventMessage("a", "b", "c", "d", PNSetMembershipEvent("a", "b", null, "c", "d", null)),
PNSetMembershipEventMessage("a", "b", "c", "d", PNSetMembershipEvent("a", "b", null, "c", "d", null, null)),
),
)
delegating.objects(
Expand Down Expand Up @@ -297,7 +297,7 @@ internal class DelegatingEventListenerTest {

@Test
fun getSetMembershipResult() {
val metadata = PNSetMembershipEvent(channel, uuid, PatchValue.of(custom), eTag, updated, PatchValue.of(status))
val metadata = PNSetMembershipEvent(channel, uuid, PatchValue.of(custom), eTag, updated, PatchValue.of(status), PatchValue.of(type))
val message = PNSetMembershipEventMessage(source, version, event, type, metadata)
val objectEvent = PNObjectEventResult(BasePubSubResult(channel, subscription, timetoken, userMetadata, publisher), message)

Expand Down
25 changes: 14 additions & 11 deletions pubnub-kotlin/pubnub-kotlin-api/config/ktlint/baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<baseline version="1.0">
<file name="src/commonMain/kotlin/com/pubnub/api/models/consumer/objects/member/MemberInclude.kt">
<error line="3" column="5" source="standard:function-naming" />
</file>
<file name="src/commonMain/kotlin/com/pubnub/api/models/consumer/objects/membership/MembershipInclude.kt">
<error line="3" column="5" source="standard:function-naming" />
</file>
Expand All @@ -16,18 +19,17 @@
<error line="845" column="13" source="standard:property-naming" />
<error line="1030" column="15" source="standard:class-naming" />
<error line="1036" column="15" source="standard:class-naming" />
<error line="1155" column="13" source="standard:property-naming" />
<error line="1161" column="13" source="standard:property-naming" />
<error line="1163" column="13" source="standard:property-naming" />
<error line="1223" column="39" source="standard:comment-wrapping" />
<error line="1308" column="15" source="standard:class-naming" />
<error line="1336" column="42" source="standard:comment-wrapping" />
<error line="1386" column="37" source="standard:comment-wrapping" />
<error line="1407" column="13" source="standard:property-naming" />
<error line="1156" column="13" source="standard:property-naming" />
<error line="1162" column="13" source="standard:property-naming" />
<error line="1164" column="13" source="standard:property-naming" />
<error line="1224" column="39" source="standard:comment-wrapping" />
<error line="1309" column="15" source="standard:class-naming" />
<error line="1337" column="42" source="standard:comment-wrapping" />
<error line="1387" column="37" source="standard:comment-wrapping" />
<error line="1408" column="13" source="standard:property-naming" />
<error line="1412" column="13" source="standard:property-naming" />
<error line="1409" column="13" source="standard:property-naming" />
<error line="1413" column="13" source="standard:property-naming" />
<error line="1432" column="9" source="standard:property-naming" />
<error line="1414" column="13" source="standard:property-naming" />
<error line="1433" column="9" source="standard:property-naming" />
<error line="1434" column="9" source="standard:property-naming" />
<error line="1435" column="9" source="standard:property-naming" />
Expand All @@ -40,7 +42,7 @@
<error line="1442" column="9" source="standard:property-naming" />
<error line="1443" column="9" source="standard:property-naming" />
<error line="1444" column="9" source="standard:property-naming" />
<error line="1448" column="9" source="standard:property-naming" />
<error line="1445" column="9" source="standard:property-naming" />
<error line="1449" column="9" source="standard:property-naming" />
<error line="1450" column="9" source="standard:property-naming" />
<error line="1451" column="9" source="standard:property-naming" />
Expand Down Expand Up @@ -76,5 +78,6 @@
<error line="1481" column="9" source="standard:property-naming" />
<error line="1482" column="9" source="standard:property-naming" />
<error line="1483" column="9" source="standard:property-naming" />
<error line="1484" column="9" source="standard:property-naming" />
</file>
</baseline>
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ internal fun createPNMember(from: KMPMembershipMetadata?): PNMember {
custom = PatchValue.of(from.custom()?.safeCast()),
updated = from.updated().orEmpty(),
eTag = from.eTag().orEmpty(),
status = PatchValue.of(from.status())
status = PatchValue.of(from.status()),
type = PatchValue.of(null) // todo add when available
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ private fun mapAppContextEvent(from: KMPAppContextEventResult?): PNObjectEventMe
custom = PatchValue.of(from.metadata().custom()?.safeCast()),
eTag = from.metadata().eTag().orEmpty(),
updated = from.metadata().updated().orEmpty(),
status = PatchValue.of(from.metadata().status().orEmpty())
status = PatchValue.of(from.metadata().status().orEmpty()),
type = null // todo add when available
)
)
is KMPRemoveMembershipResult ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fun MemberInclude(
includeUserType: Boolean = false,
includeUserStatus: Boolean = false,
) = object : MemberInclude {
override val includeCustom: Boolean = includeCustom
override val includeCustom: Boolean = includeCustom
override val includeStatus: Boolean = includeStatus
override val includeType: Boolean = includeType
override val includeTotalCount: Boolean = includeTotalCount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ class PNChannelMembershipTest {
custom = null,
updated = randomString(),
eTag = randomString(),
status = PatchValue.of(randomString())
status = PatchValue.of(randomString()),
type = PatchValue.of(randomString())
)
val expectedMembership = originalMembership.copy(
updated = updateMembership.updated,
eTag = updateMembership.eTag,
status = updateMembership.status,
type = updateMembership.ty
type = updateMembership.type
)

val actualMembership = originalMembership + updateMembership
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class MembersTest : BaseIntegrationTest() {

@Test
fun can_delete_members() = runTest {
if (PLATFORM == "JS") { // todo enable for JS once is implemented
if (PLATFORM == "JS" || PLATFORM == "iOS") { // todo enable for JS/iOS once is implemented
return@runTest
}
// given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class MembershipsTest : BaseIntegrationTest() {

@Test
fun can_delete_membership() = runTest {
if (PLATFORM == "JS") { // todo enable for JS once is implemented
if (PLATFORM == "JS" || PLATFORM == "iOS") { // todo enable for JS/iOS once is implemented
return@runTest
}
// given
Expand All @@ -111,7 +111,7 @@ class MembershipsTest : BaseIntegrationTest() {

@Test
fun can_receive_delete_membership_event() = runTest {
if (PLATFORM == "JS") { // todo enable for JS once is implemented
if (PLATFORM == "JS" || PLATFORM == "iOS") { // todo enable for JS/iOS once is implemented
return@runTest
}
pubnub.test(backgroundScope) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,7 @@ open external class PubNub(config: Any /* UUID | UserId */) {
interface UUIDMembershipObject : v2ObjectDataOmitId {
var uuid: UUIDMetadataObject // UUIDMetadataObject & HasStatus | HasId
var status: String?
var type: String?
}

interface ChannelMembershipObject : v2ObjectDataOmitId {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ internal fun PubNub.UUIDMembershipObject.toPNMember() = PNMember(
patchValueOf(custom.letIfDefined { it?.toMap() }),
updated,
eTag,
patchValueOf(status),
status = patchValueOf(status),
type = patchValueOf(type),
)

internal fun ManageChannelMembersResponse.toPNMemberArrayResult() = PNMemberArrayResult(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ actual fun createEventListener(
PatchValue.of(it.custom?.toMap()),
it.eTag,
it.updated,
PatchValue.of(it.asDynamic().status) // todo missing
PatchValue.of(it.asDynamic().status), // todo missing
null // todo add type when available
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ actual interface PubNub {
includeType: Boolean
): ManageChannelMembers


actual fun setChannelMembers(
channel: String,
users: List<MemberInput>,
Expand All @@ -411,7 +410,6 @@ actual interface PubNub {
includeType: Boolean
): ManageChannelMembers


actual fun removeChannelMembers(
channel: String,
userIds: List<String>,
Expand Down
10 changes: 0 additions & 10 deletions pubnub-kotlin/pubnub-kotlin-impl/config/ktlint/baseline.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<baseline version="1.0">
<file name="src/integrationTest/kotlin/com/pubnub/api/integration/PublishIntegrationTests.kt">
<error line="11" column="1" source="standard:no-unused-imports" />
<error line="16" column="1" source="standard:no-unused-imports" />
</file>
<file name="src/main/kotlin/com/pubnub/internal/endpoints/FetchMessagesEndpoint.kt">
<error line="47" column="1" source="standard:no-consecutive-blank-lines" />
</file>
<file name="src/main/kotlin/com/pubnub/internal/endpoints/pubsub/PublishEndpoint.kt">
<error line="91" column="21" source="standard:no-multi-spaces" />
</file>
<file name="src/main/kotlin/com/pubnub/internal/managers/BasePathManager.kt">
<error line="15" column="17" source="standard:property-naming" />
<error line="21" column="17" source="standard:property-naming" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class EmitMessagesEffectTest {
"AZO/t53al7m8fw",
"2023-05-05T14:26:55.824848794Z",
null,
null,
)
val pnSetMembershipEventMessage =
PNSetMembershipEventMessage("objects", "2.0", "set", objectEventType, pnSetMembershipEvent)
Expand Down

0 comments on commit b0f6ce0

Please sign in to comment.