Skip to content

Commit

Permalink
Adds test for streamGroupMessages
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronvoell committed Feb 28, 2024
1 parent d6a719d commit d4eb58c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Tests/XMTPTests/GroupTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,26 @@ class GroupTests: XCTestCase {

await waitForExpectations(timeout: 3)
}

func testCanStreamGroupMessages() async throws {
let fixtures = try await localFixtures()

let expectation1 = expectation(description: "got a conversation")
expectation1.expectedFulfillmentCount = 2
let group = try await fixtures.bobClient.conversations.newGroup(with: [fixtures.alice.address])
try await fixtures.bobClient.conversations.sync()
let bobGroup = try await fixtures.bobClient.conversations.list(includeGroups: true)[0]
Task(priority: .userInitiated) {
for try await _ in try await group.streamDecryptedMessages() {
expectation1.fulfill()
}
}

try await group.send(content: "hi")
try await bobGroup.send(content: "hi")

await waitForExpectations(timeout: 3)
}

func testCanStreamAllDecryptedMessages() async throws {
let fixtures = try await localFixtures()
Expand Down

0 comments on commit d4eb58c

Please sign in to comment.