Skip to content

Commit

Permalink
feat: Consent Refresh Pagination
Browse files Browse the repository at this point in the history
Added pagination to consent refresh call
  • Loading branch information
Alex Risch authored and Alex Risch committed Apr 5, 2024
1 parent 0a625c9 commit 44123b9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Tests/XMTPTests/ContactsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import XCTest
@testable import XMTPiOS
import XMTPTestHelpers

public enum TestError: Error {
case bundleError
}

@available(iOS 15, *)
class ContactsTests: XCTestCase {
func testNormalizesAddresses() async throws {
Expand Down Expand Up @@ -81,4 +85,19 @@ class ContactsTests: XCTestCase {
result = await contacts.isDenied(fixtures.alice.address)
XCTAssertTrue(result)
}

func testRefreshConsentListPagination() async throws {
let fixtures = await fixtures()
let contacts = fixtures.bobClient.contacts
let aliceAddress = fixtures.alice.address
try await contacts.deny(addresses: [aliceAddress])
let date = Date()
try await contacts.allow(addresses: [aliceAddress])

let result = try await contacts.consentList.load(pagination: Pagination(before: date, direction: .ascending))
XCTAssertTrue(result.entries[ConsentListEntry.address(aliceAddress).key]?.consentType == .denied)

let afterResult = try await contacts.consentList.load(pagination: Pagination(after: date, direction: .ascending))
XCTAssertTrue(afterResult.entries[ConsentListEntry.address(aliceAddress).key]?.consentType == .allowed)
}
}

0 comments on commit 44123b9

Please sign in to comment.