Skip to content

Commit

Permalink
add a test for it
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Sep 13, 2023
1 parent 379f3d4 commit 7023ae4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Sources/XMTPTestHelpers/TestHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@ public class FakeApiClient: ApiClient {
}
}
}

if let direction = pagination?.direction {
switch direction {
case .ascending:
result = Array(result.reversed())
default:
break
}
}

var queryResponse = QueryResponse()
queryResponse.envelopes = result
Expand Down
6 changes: 6 additions & 0 deletions Tests/XMTPTests/IntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,12 @@ final class IntegrationTests: XCTestCase {
XCTAssertEqual(1, messages3.count)
let nowMessage2 = messages3[0]
XCTAssertEqual("now", nowMessage2.body)

let messagesAsc = try await convo.messages(direction: .ascending)
XCTAssertEqual("10 seconds ago", messagesAsc[0].body)

let messagesDesc = try await convo.messages(direction: .descending)
XCTAssertEqual("now", messagesDesc[0].body)
}

func testStreamingMessagesShouldBeReceived() async throws {
Expand Down

0 comments on commit 7023ae4

Please sign in to comment.