Skip to content

Commit 875bb13

Browse files
committed
Update CardPresentPaymentsConfiguration unit tests
1 parent 6e3f0e1 commit 875bb13

File tree

2 files changed

+8
-35
lines changed

2 files changed

+8
-35
lines changed

WooCommerce/WooCommerceTests/ViewRelated/CardPresentPayments/CardPresentPaymentsOnboardingUseCaseTests.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ class CardPresentPaymentsOnboardingUseCaseTests: XCTestCase {
2222
stores = MockStoresManager(sessionManager: .makeForTesting(authenticated: true))
2323
stores.whenReceivingAction(ofType: AppSettingsAction.self) { action in
2424
switch action {
25-
case .loadStripeInPersonPaymentsSwitchState(let completion):
26-
completion(.success(true))
2725
case .loadCanadaInPersonPaymentsSwitchState(let completion):
2826
completion(.success(true))
2927
default:

Yosemite/YosemiteTests/Model/CardPresentConfigurationTests.swift

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,30 @@ import XCTest
44

55
class CardPresentConfigurationTests: XCTestCase {
66
// MARK: - US Tests
7-
func test_configuration_for_US_with_Stripe_enabled_Canada_enabled() throws {
8-
let configuration = try CardPresentPaymentsConfiguration(country: "US", stripeEnabled: true, canadaEnabled: true)
7+
func test_configuration_for_US_with_Canada_enabled() throws {
8+
let configuration = try CardPresentPaymentsConfiguration(country: "US", canadaEnabled: true)
99
XCTAssertEqual(configuration.currencies, [Constants.Currency.usd])
1010
XCTAssertEqual(configuration.paymentGateways, [Constants.PaymentGateway.wcpay, Constants.PaymentGateway.stripe])
1111
XCTAssertEqual(configuration.paymentMethods, [.cardPresent])
1212
}
1313

14-
func test_configuration_for_US_with_Stripe_enabled_Canada_disabled() throws {
15-
let configuration = try CardPresentPaymentsConfiguration(country: "US", stripeEnabled: true, canadaEnabled: false)
14+
func test_configuration_for_US_with_Canada_disabled() throws {
15+
let configuration = try CardPresentPaymentsConfiguration(country: "US", canadaEnabled: false)
1616
XCTAssertEqual(configuration.currencies, [Constants.Currency.usd])
1717
XCTAssertEqual(configuration.paymentGateways, [Constants.PaymentGateway.wcpay, Constants.PaymentGateway.stripe])
1818
XCTAssertEqual(configuration.paymentMethods, [.cardPresent])
1919
}
2020

21-
func test_configuration_for_US_with_Stripe_disabled_Canada_enabled() throws {
22-
let configuration = try CardPresentPaymentsConfiguration(country: "US", stripeEnabled: false, canadaEnabled: true)
23-
XCTAssertEqual(configuration.currencies, [Constants.Currency.usd])
24-
XCTAssertEqual(configuration.paymentGateways, [Constants.PaymentGateway.wcpay])
25-
XCTAssertEqual(configuration.paymentMethods, [.cardPresent])
26-
}
27-
28-
func test_configuration_for_US_with_Stripe_disabled_Canada_disabled() throws {
29-
let configuration = try CardPresentPaymentsConfiguration(country: "US", stripeEnabled: false, canadaEnabled: false)
30-
XCTAssertEqual(configuration.currencies, [Constants.Currency.usd])
31-
XCTAssertEqual(configuration.paymentGateways, [Constants.PaymentGateway.wcpay])
32-
XCTAssertEqual(configuration.paymentMethods, [.cardPresent])
33-
}
34-
3521
// MARK: - Canada Tests
36-
func test_configuration_for_Canada_with_Stripe_enabled_Canada_enabled() throws {
37-
let configuration = try CardPresentPaymentsConfiguration(country: "CA", stripeEnabled: true, canadaEnabled: true)
38-
XCTAssertEqual(configuration.currencies, [Constants.Currency.cad])
39-
XCTAssertEqual(configuration.paymentGateways, [Constants.PaymentGateway.wcpay])
40-
XCTAssertEqual(configuration.paymentMethods, [.cardPresent, .interacPresent])
41-
}
42-
43-
func test_configuration_for_Canada_with_Stripe_enabled_Canada_disabled() {
44-
XCTAssertThrowsError(try CardPresentPaymentsConfiguration(country: "CA", stripeEnabled: true, canadaEnabled: false))
45-
}
46-
47-
func test_configuration_for_Canada_with_Stripe_disabled_Canada_enabled() throws {
48-
let configuration = try CardPresentPaymentsConfiguration(country: "CA", stripeEnabled: false, canadaEnabled: true)
22+
func test_configuration_for_Canada_with_Canada_enabled() throws {
23+
let configuration = try CardPresentPaymentsConfiguration(country: "CA", canadaEnabled: true)
4924
XCTAssertEqual(configuration.currencies, [Constants.Currency.cad])
5025
XCTAssertEqual(configuration.paymentGateways, [Constants.PaymentGateway.wcpay])
5126
XCTAssertEqual(configuration.paymentMethods, [.cardPresent, .interacPresent])
5227
}
5328

54-
func test_configuration_for_Canada_with_Stripe_disabled_Canada_disabled() throws {
55-
XCTAssertThrowsError(try CardPresentPaymentsConfiguration(country: "CA", stripeEnabled: false, canadaEnabled: false))
29+
func test_configuration_for_Canada_with_Canada_disabled() {
30+
XCTAssertThrowsError(try CardPresentPaymentsConfiguration(country: "CA", canadaEnabled: false))
5631
}
5732

5833
private enum Constants {

0 commit comments

Comments
 (0)