-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add test func. * Example of using a mirror protocol for testing allowing a mock struct to be used in the tests * derp; I forgot to git add the Protocols.swift file * implement mapper test & add test command in bitrise.yml. * improve test method. --------- Co-authored-by: Brian Cooke <bric@stripe.com>
- Loading branch information
1 parent
e4087f0
commit f2750b4
Showing
4 changed files
with
254 additions
and
6 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
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,65 @@ | ||
import StripeTerminal | ||
|
||
/** | ||
This file includes a collection of protocols that mirror a selection of the StripeTerminal iOS public classes. | ||
This enables writing swift unit tests against these protocols since the Terminal iOS SDK | ||
classes prevent instantiating them (init and new are annotated as unavailable). | ||
|
||
Note the naming here is exactly as they are named in the native SDK so we can use them interchangeably. We will | ||
need to keep them in sync. | ||
*/ | ||
|
||
protocol CollectInputsResult { | ||
var skipped: Bool { get } | ||
} | ||
|
||
protocol TextResult : CollectInputsResult { | ||
var text: String? { get } | ||
var toggles: [NSNumber] { get } | ||
} | ||
|
||
protocol NumericResult : CollectInputsResult { | ||
var numericString: String? { get } | ||
var toggles: [NSNumber] { get } | ||
} | ||
|
||
protocol PhoneResult : CollectInputsResult { | ||
var phone: String? { get } | ||
var toggles: [NSNumber] { get } | ||
} | ||
|
||
protocol EmailResult : CollectInputsResult { | ||
var email: String? { get } | ||
var toggles: [NSNumber] { get } | ||
} | ||
|
||
protocol SignatureResult : CollectInputsResult { | ||
var signatureSvg: String? { get } | ||
var toggles: [NSNumber] { get } | ||
} | ||
|
||
protocol SelectionResult : CollectInputsResult { | ||
var selection: String? { get } | ||
var toggles: [NSNumber] { get } | ||
} | ||
|
||
extension StripeTerminal.TextResult : TextResult { | ||
} | ||
|
||
extension StripeTerminal.NumericResult : NumericResult { | ||
} | ||
|
||
extension StripeTerminal.PhoneResult : PhoneResult { | ||
} | ||
|
||
extension StripeTerminal.EmailResult : EmailResult { | ||
} | ||
|
||
extension StripeTerminal.SignatureResult : SignatureResult { | ||
} | ||
|
||
extension StripeTerminal.SelectionResult : SelectionResult { | ||
} | ||
|
||
extension StripeTerminal.CollectInputsResult : CollectInputsResult { | ||
} |
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