-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement test cases for
ProductView
- Create the shared `FlareMock` package - Implement snapshot tests - Implement unit tests
- Loading branch information
1 parent
0a84939
commit ffa5df3
Showing
57 changed files
with
1,048 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 0 additions & 130 deletions
130
.swiftpm/xcode/xcshareddata/xcschemes/Flare-Package.xcscheme
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...TestHelpers/Fakes/StoreProduct+Fake.swift → ...s/FlareMock/Fakes/StoreProduct+Fake.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// Flare | ||
// Copyright © 2024 Space Code. All rights reserved. | ||
// | ||
|
||
@testable import Flare | ||
import Foundation | ||
|
||
public extension StoreTransaction { | ||
static func fake() -> StoreTransaction { | ||
StoreTransaction(paymentTransaction: PaymentTransaction(PaymentTransactionMock())) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// Flare | ||
// Copyright © 2024 Space Code. All rights reserved. | ||
// | ||
|
||
import StoreKit | ||
|
||
public final class PaymentTransactionMock: SKPaymentTransaction { | ||
override public init() {} | ||
|
||
public var invokedTransactionState = false | ||
public var invokedTransactionStateCount = 0 | ||
public var stubbedTransactionState: SKPaymentTransactionState! | ||
|
||
override public var transactionState: SKPaymentTransactionState { | ||
stubbedTransactionState | ||
} | ||
|
||
public var invokedTransactionIndentifier = false | ||
public var invokedTransactionIndentifierCount = 0 | ||
public var stubbedTransactionIndentifier: String? | ||
|
||
override public var transactionIdentifier: String? { | ||
invokedTransactionIndentifier = true | ||
invokedTransactionStateCount += 1 | ||
return stubbedTransactionIndentifier | ||
} | ||
|
||
public var invokedPayment = false | ||
public var invokedPaymentCount = 0 | ||
public var stubbedPayment: SKPayment! | ||
|
||
override public var payment: SKPayment { | ||
invokedPayment = true | ||
invokedPaymentCount += 1 | ||
return stubbedPayment | ||
} | ||
|
||
public var stubbedOriginal: SKPaymentTransaction? | ||
override public var original: SKPaymentTransaction? { | ||
stubbedOriginal | ||
} | ||
|
||
public var stubbedError: Error? | ||
override public var error: Error? { | ||
stubbedError | ||
} | ||
} |
Oops, something went wrong.