Skip to content

Commit

Permalink
fix up all the tests around can message
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Feb 19, 2024
1 parent d1c0ec7 commit e55c255
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sources/XMTPiOS/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}


Expand Down
6 changes: 3 additions & 3 deletions Tests/XMTPTests/GroupTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}

Expand All @@ -169,15 +169,15 @@ 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])
}

func testCanMessage() async throws {
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)
}
Expand Down

0 comments on commit e55c255

Please sign in to comment.