-
Notifications
You must be signed in to change notification settings - Fork 328
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
[StoreKit 2] Raise error if no AppTransaction and no Transaction present #4054
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -726,6 +726,27 @@ class PurchasesOrchestratorSK2Tests: BasePurchasesOrchestratorTests, PurchasesOr | |
expect(customerInfo) == mockCustomerInfo | ||
} | ||
|
||
func testSyncPurchasesSK2DoesNotPostReceiptAndRaisesErrorIfNoTransactionsAndNoAppTransactionJWSToken() | ||
async throws { | ||
self.mockTransactionFetcher.stubbedFirstVerifiedTransaction = nil | ||
self.mockTransactionFetcher.stubbedAppTransactionJWS = nil | ||
self.customerInfoManager.stubbedCachedCustomerInfoResult = CustomerInfo.missingOriginalApplicationVersion | ||
|
||
do { | ||
_ = try await self.orchestrator.syncPurchases(receiptRefreshPolicy: .always, | ||
isRestore: true, | ||
initiationSource: .restore) | ||
fail("Expected error") | ||
} catch { | ||
expect(error).to(matchError(ErrorCode.storeProblemError)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way to make sure that this error is thrown from the main thread? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not here afaik, we'll figure out a different way to test this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was just doing some similar stuff on the retry PR, one thing that you might be able to do to help is to mock out the |
||
} | ||
|
||
expect(self.backend.invokedPostReceiptData).to(beFalse()) | ||
|
||
expect(self.customerInfoManager.invokedCachedCustomerInfo).to(beTrue()) | ||
expect(self.customerInfoManager.invokedCachedCustomerInfoCount) == 1 | ||
} | ||
|
||
func testSyncPurchasesCallsSuccessDelegateMethod() async throws { | ||
let transaction = try await createTransaction(finished: true) | ||
self.mockTransactionFetcher.stubbedFirstVerifiedTransaction = transaction | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make sure that this is dispatched on the main thread?