Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoSoto committed Feb 6, 2024
1 parent eacefc8 commit 39c0c4c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Tests/RevenueCatUITests/PresentIfNeededTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,29 @@ class PresentIfNeededTests: TestCase {
expect(error).toEventually(matchError(Self.failureError))
}

func testPresentFullScreen() throws {
var customerInfo: CustomerInfo?

try Text("")
.presentPaywallIfNeeded(offering: Self.offering,
introEligibility: .producing(eligibility: .eligible),
purchaseHandler: Self.purchaseHandler,
presentationMode: .fullScreen) { _ in
return true
} purchaseCompleted: {
customerInfo = $0
} customerInfoFetcher: {
return TestData.customerInfo
}
.addToHierarchy()

Task {
_ = try await Self.purchaseHandler.purchase(package: Self.package)
}

expect(customerInfo).toEventually(be(TestData.customerInfo))
}

private static let purchaseHandler: PurchaseHandler = .mock()
private static let failingHandler: PurchaseHandler = .failing(failureError)
private static let offering = TestData.offeringWithNoIntroOffer
Expand Down

0 comments on commit 39c0c4c

Please sign in to comment.