Skip to content

Commit

Permalink
Implement integration tests
Browse files Browse the repository at this point in the history
- Create a new target that contains the integration tests
- Implement three test plans: `AllTests`, `UnitTests`, `IntegrationTests`
  • Loading branch information
ns-vasilev committed Dec 31, 2023
1 parent 239e38a commit e828dc4
Show file tree
Hide file tree
Showing 26 changed files with 702 additions and 467 deletions.
24 changes: 24 additions & 0 deletions Sources/Flare/Classes/Models/IAPError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,30 @@ public enum IAPError: Swift.Error {

extension IAPError {
init(error: Swift.Error?) {
if #available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *) {
if let storeKitError = error as? StoreKitError {
self.init(storeKitError: storeKitError)
} else {
self.init(error)
}
} else {
self.init(error)
}
}

@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *)
private init(storeKitError: StoreKit.StoreKitError) {
switch storeKitError {
case .unknown:
self = .unknown
case .userCancelled:
self = .paymentCancelled
default:
self = .with(error: storeKitError)
}
}

private init(_ error: Swift.Error?) {
switch (error as? SKError)?.code {
case .paymentNotAllowed:
self = .paymentNotAllowed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ protocol IRefundProvider {
@available(macOS, unavailable)
@available(watchOS, unavailable)
@available(tvOS, unavailable)
@MainActor
func beginRefundRequest(productID: String) async throws -> RefundRequestStatus
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ extension RefundProvider: IRefundProvider {
@available(macOS, unavailable)
@available(watchOS, unavailable)
@available(tvOS, unavailable)
@MainActor
func beginRefundRequest(productID: String) async throws -> RefundRequestStatus {
let windowScene = try systemInfoProvider.currentScene
let transactionID = try await refundRequestProvider.verifyTransaction(productID: productID)
Expand Down

This file was deleted.

156 changes: 0 additions & 156 deletions Tests/FlareTests/UnitTests/FlareStoreKit2Tests.swift

This file was deleted.

146 changes: 0 additions & 146 deletions Tests/FlareTests/UnitTests/Providers/IAPProviderStoreKit2Tests.swift

This file was deleted.

Loading

0 comments on commit e828dc4

Please sign in to comment.