Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LocalReceiptParserStoreKitTests: fixed flaky test failure #2785

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class LocalReceiptParserStoreKitTests: StoreKitConfigTestCase {
func testReceiptParserParsesReceiptWithSingleIAP() async throws {
try AvailabilityChecks.iOS15APIAvailableOrSkipTest()
let product = try await fetchSk2Product()
let purchaseTime = Date()

_ = try await product.purchase()

let receiptData = await self.receiptFetcher.receiptData(refreshPolicy: .always)
Expand All @@ -76,7 +78,7 @@ class LocalReceiptParserStoreKitTests: StoreKitConfigTestCase {
expect(firstPurchase.originalTransactionId).to(beNil())
expect(firstPurchase.productType) == .unknown

expect(firstPurchase.purchaseDate).to(beCloseTo(Date(), within: 5))
expect(firstPurchase.purchaseDate).to(beCloseTo(purchaseTime, within: 5))
expect(firstPurchase.originalPurchaseDate).to(beNil())

expect(firstPurchase.expiresDate).toNot(beNil())
Expand Down