Skip to content

Commit

Permalink
Refactor unit tests
Browse files Browse the repository at this point in the history
- Write unit tests for the new methods
- Improve the readability of the existing test cases
  • Loading branch information
ns-vasilev committed Dec 29, 2023
1 parent 04839f2 commit 5242ebf
Show file tree
Hide file tree
Showing 17 changed files with 410 additions and 286 deletions.
8 changes: 8 additions & 0 deletions Sources/Flare/Classes/Models/StoreTransaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,11 @@ extension StoreTransaction: IStoreTransaction {
storeTransaction.environment
}
}

// MARK: Equatable

extension StoreTransaction: Equatable {
public static func == (lhs: StoreTransaction, rhs: StoreTransaction) -> Bool {
lhs.transactionIdentifier == rhs.transactionIdentifier
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ final class IAPProvider: IIAPProvider {

func purchase(product: StoreProduct) async throws -> StoreTransaction {
try await withCheckedThrowingContinuation { continuation in
purchase(product: product) { result in
self.purchase(product: product) { result in
continuation.resume(with: result)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import StoreKit
import StoreKitTest
import XCTest

class StoreKitSessionTestCase: XCTestCase {
// MARK: Properties

private var session: SKTestSession!

// MARK: XCTestCase

// override func
}
// class StoreKitSessionTestCase: XCTestCase {
// // MARK: Properties
//
// private var session: SKTestSession!
//
// // MARK: XCTestCase
//
//// override func
// }
23 changes: 19 additions & 4 deletions Tests/FlareTests/UnitTests/Flare.storekit
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"identifier" : "15BDB648",
"identifier" : "95D98A48",
"nonRenewingSubscriptions" : [

],
"products" : [
{
"displayPrice" : "0.99",
"familyShareable" : false,
"internalID" : "55B686B4",
"internalID" : "169432A7",
"localizations" : [
{
"description" : "com.flare.test_purchase_1",
Expand All @@ -17,12 +17,12 @@
],
"productID" : "com.flare.test_purchase_1",
"referenceName" : "com.flare.test_purchase_1",
"type" : "NonConsumable"
"type" : "Consumable"
},
{
"displayPrice" : "0.99",
"familyShareable" : false,
"internalID" : "63681F89",
"internalID" : "33E61322",
"localizations" : [
{
"description" : "com.flare.test_purchase_2",
Expand All @@ -33,6 +33,21 @@
"productID" : "com.flare.test_purchase_2",
"referenceName" : "com.flare.test_purchase_2",
"type" : "Consumable"
},
{
"displayPrice" : "0.99",
"familyShareable" : false,
"internalID" : "1CBF43E6",
"localizations" : [
{
"description" : "com.flare.test_non_consumable_purchase_1",
"displayName" : "com.flare.test_non_consumable_",
"locale" : "en_US"
}
],
"productID" : "com.flare.test_non_consumable_purchase_1",
"referenceName" : null,
"type" : "NonConsumable"
}
],
"settings" : {
Expand Down
Loading

0 comments on commit 5242ebf

Please sign in to comment.