diff --git a/Sources/XMTPiOS/Client.swift b/Sources/XMTPiOS/Client.swift index 5b82ffb0..3a949a7b 100644 --- a/Sources/XMTPiOS/Client.swift +++ b/Sources/XMTPiOS/Client.swift @@ -238,7 +238,7 @@ public final class Client { return false } - return try await v3Client.canMessage(accountAddresses: addresses).contains(false) + return try await !v3Client.canMessage(accountAddresses: addresses).contains(false) } diff --git a/Tests/XMTPTests/GroupTests.swift b/Tests/XMTPTests/GroupTests.swift index 3ca12f29..d72a1eca 100644 --- a/Tests/XMTPTests/GroupTests.swift +++ b/Tests/XMTPTests/GroupTests.swift @@ -142,7 +142,7 @@ class GroupTests: XCTestCase { fixtures.fred.address.localizedLowercase ].sorted(), members) - let groupChangedMessage: GroupMembershipChanges = try await group.messages().last!.content() + let groupChangedMessage: GroupMembershipChanges = try await group.messages().first!.content() XCTAssertEqual(groupChangedMessage.membersAdded.map(\.accountAddress.localizedLowercase), [fixtures.fred.address.localizedLowercase]) } @@ -169,7 +169,7 @@ class GroupTests: XCTestCase { fixtures.alice.address.localizedLowercase, ].sorted(), newMembers) - let groupChangedMessage: GroupMembershipChanges = try await group.messages().last!.content() + let groupChangedMessage: GroupMembershipChanges = try await group.messages().first!.content() XCTAssertEqual(groupChangedMessage.membersRemoved.map(\.accountAddress.localizedLowercase), [fixtures.fred.address.localizedLowercase]) } @@ -177,7 +177,7 @@ class GroupTests: XCTestCase { let fixtures = try await localFixtures() let notOnNetwork = try PrivateKey.generate() let canMessage = try await fixtures.aliceClient.canMessageV3(addresses: [fixtures.bobClient.address]) - let cannotMessage = try await fixtures.aliceClient.canMessageV3(addresses: [notOnNetwork.address]) + let cannotMessage = try await fixtures.aliceClient.canMessageV3(addresses: [notOnNetwork.address, fixtures.bobClient.address]) XCTAssert(canMessage) XCTAssert(!cannotMessage) }