-
Notifications
You must be signed in to change notification settings - Fork 316
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
SKError
, StoreKitError
, and Product.PurchaseError
conform to ErrorCodeConvertible
+ tests
#1473
Conversation
func testCurrentlySubscribedError() throws { | ||
let error = try XCTUnwrap( | ||
NSError( | ||
domain: SKErrorDomain, | ||
code: SKError.unknown.rawValue, | ||
userInfo: [ | ||
NSUnderlyingErrorKey: NSError( | ||
domain: "ASDServerErrorDomain", | ||
code: 3532, | ||
userInfo: [:] | ||
) | ||
] | ||
) as? SKError | ||
) | ||
|
||
verifyPurchasesError(error, | ||
expectedCode: .productAlreadyPurchasedError, | ||
underlyingError: error) | ||
} |
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.
These are much better to test this way instead of in PurchasesTests
. Though I left the original tests too.
@@ -15,9 +15,9 @@ import StoreKit | |||
|
|||
/// - SeeAlso: SKError+Extensions | |||
@available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) | |||
extension StoreKitError { | |||
extension StoreKitError: ErrorCodeConvertible { |
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.
Now all our errors conform to this 🎉
SKError
, StoreKitError
, and Product.PurchaseError
conform to ErrorCodeConvertible
and added testsSKError
, StoreKitError
, and Product.PurchaseError
conform to ErrorCodeConvertible
+ tests
d65d66e
to
67c8f43
Compare
67c8f43
to
3e4cb4c
Compare
3e4cb4c
to
d124750
Compare
underlyingError: error) | ||
} | ||
|
||
func testPaymentSheetCancelledError() throws { |
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.
YESSssssss
) as? SKError | ||
) | ||
|
||
verifyPurchasesError(error, |
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.
This is so good that we have tests for this. I'm loving the new errors
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.
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.
🕺🐐
d124750
to
1930eb0
Compare
1930eb0
to
2d129d0
Compare
…rrorCodeConvertible` and added tests Follow up to #1437. Fixes [CF-323]
2d129d0
to
59422da
Compare
Follow up to #1437.
Fixes CF-323