Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ public struct CardPresentPaymentsConfiguration: Equatable {
countryCode: country,
paymentMethods: [.cardPresent],
currencies: [.GBP],
paymentGateways: [WCPayAccount.gatewayID],
paymentGateways: [WCPayAccount.gatewayID, StripeAccount.gatewayID],
supportedReaders: [.wisepad3, .tapToPay],
supportedPluginVersions: [.init(plugin: .wcPay, minimumVersion: "4.4.0")],
supportedPluginVersions: [
.init(plugin: .wcPay, minimumVersion: "4.4.0"),
.init(plugin: .stripe, minimumVersion: "6.2.0")
],
minimumAllowedChargeAmount: NSDecimalNumber(string: "0.3"),
stripeSmallestCurrencyUnitMultiplier: 100,
contactlessLimitAmount: 10000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CardPresentConfigurationTests: XCTestCase {
let configuration = CardPresentPaymentsConfiguration(country: .GB)
XCTAssertTrue(configuration.isSupportedCountry)
XCTAssertEqual(configuration.currencies, [.GBP])
XCTAssertEqual(configuration.paymentGateways, [Constants.PaymentGateway.wcpay])
XCTAssertEqual(configuration.paymentGateways, [Constants.PaymentGateway.wcpay, Constants.PaymentGateway.stripe])
XCTAssertEqual(configuration.paymentMethods, [.cardPresent])
XCTAssertEqual(configuration.purchaseCardReaderUrl(utmProvider: MockUTMParameterProvider()).absoluteString, Constants.PurchaseURL.gb)
assertEqual([.wisepad3, .tapToPay], configuration.supportedReaders)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class CardPresentPaymentsOnboardingUseCaseTests: XCTestCase {
XCTAssertNotEqual(state, .countryNotSupported(countryCode: .GB))
}

func test_onboarding_returns_country_unsupported_with_uk_when_stripe_plugin_installed() {
func test_onboarding_returns_setup_not_completed_with_uk_when_stripe_plugin_installed() {
// Given
setupCountry(country: .gb)
setupStripePlugin(status: .active, version: .minimumSupportedVersion)
Expand All @@ -214,10 +214,10 @@ class CardPresentPaymentsOnboardingUseCaseTests: XCTestCase {
let state = useCase.state

// Then
XCTAssertEqual(state, .countryNotSupportedStripe(plugin: .stripe, countryCode: .GB))
XCTAssertEqual(state, .pluginSetupNotCompleted(plugin: .stripe))
}

func test_onboarding_returns_setup_not_completed_stripe_when_stripe_and_wcPay_plugins_are_installed_in_UK() {
func test_onboarding_returns_select_plugin_when_stripe_and_wcPay_plugins_are_installed_in_UK() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a good place for a parameterised test – since it's identical to the US test other than the country code.

This isn't an expectation for this PR – you can't use it here, because this is all still written for XCTest, the old testing framework. I just thought it was worth letting you know that is possible with iOS tests, if you use SwiftTesting, the newer framework.

Generally, all new test files should use SwiftTesting, and it's nice-to-have to convert tests which we're heavily editing/adding to. I don't think I would in this case, as it's a small change and you don't need to add a lot of tests, but you could if you want to.

Here are some docs – but again, don't feel you have to do this now!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sharing the context about SwiftTesting 🙇

// Given
setupCountry(country: .gb)
setupStripePlugin(status: .active, version: .minimumSupportedVersion)
Expand All @@ -230,7 +230,7 @@ class CardPresentPaymentsOnboardingUseCaseTests: XCTestCase {
let state = useCase.state

// Then
XCTAssertEqual(state, .pluginSetupNotCompleted(plugin: .wcPay))
XCTAssertEqual(state, .selectPlugin(pluginSelectionWasCleared: false))
}

func test_onboarding_returns_wcpay_plugin_unsupported_version_for_uk_when_version_unsupported() {
Expand Down