@@ -5,54 +5,62 @@ import XCTest
55class CardPresentConfigurationTests : XCTestCase {
66 // MARK: - US Tests
77 func test_configuration_for_US_with_Stripe_enabled_Canada_enabled( ) throws {
8- let configuration = try CardPresentPaymentsConfiguration ( country: " US " , stripeEnabled: true , canadaEnabled: true )
8+ let configuration = CardPresentPaymentsConfiguration ( country: " US " , stripeEnabled: true , canadaEnabled: true )
9+ XCTAssertTrue ( configuration. isSupportedCountry)
910 XCTAssertEqual ( configuration. currencies, [ Constants . Currency. usd] )
1011 XCTAssertEqual ( configuration. paymentGateways, [ Constants . PaymentGateway. wcpay, Constants . PaymentGateway. stripe] )
1112 XCTAssertEqual ( configuration. paymentMethods, [ . cardPresent] )
1213 }
1314
1415 func test_configuration_for_US_with_Stripe_enabled_Canada_disabled( ) throws {
15- let configuration = try CardPresentPaymentsConfiguration ( country: " US " , stripeEnabled: true , canadaEnabled: false )
16+ let configuration = CardPresentPaymentsConfiguration ( country: " US " , stripeEnabled: true , canadaEnabled: false )
17+ XCTAssertTrue ( configuration. isSupportedCountry)
1618 XCTAssertEqual ( configuration. currencies, [ Constants . Currency. usd] )
1719 XCTAssertEqual ( configuration. paymentGateways, [ Constants . PaymentGateway. wcpay, Constants . PaymentGateway. stripe] )
1820 XCTAssertEqual ( configuration. paymentMethods, [ . cardPresent] )
1921 }
2022
2123 func test_configuration_for_US_with_Stripe_disabled_Canada_enabled( ) throws {
22- let configuration = try CardPresentPaymentsConfiguration ( country: " US " , stripeEnabled: false , canadaEnabled: true )
24+ let configuration = CardPresentPaymentsConfiguration ( country: " US " , stripeEnabled: false , canadaEnabled: true )
25+ XCTAssertTrue ( configuration. isSupportedCountry)
2326 XCTAssertEqual ( configuration. currencies, [ Constants . Currency. usd] )
2427 XCTAssertEqual ( configuration. paymentGateways, [ Constants . PaymentGateway. wcpay] )
2528 XCTAssertEqual ( configuration. paymentMethods, [ . cardPresent] )
2629 }
2730
2831 func test_configuration_for_US_with_Stripe_disabled_Canada_disabled( ) throws {
29- let configuration = try CardPresentPaymentsConfiguration ( country: " US " , stripeEnabled: false , canadaEnabled: false )
32+ let configuration = CardPresentPaymentsConfiguration ( country: " US " , stripeEnabled: false , canadaEnabled: false )
33+ XCTAssertTrue ( configuration. isSupportedCountry)
3034 XCTAssertEqual ( configuration. currencies, [ Constants . Currency. usd] )
3135 XCTAssertEqual ( configuration. paymentGateways, [ Constants . PaymentGateway. wcpay] )
3236 XCTAssertEqual ( configuration. paymentMethods, [ . cardPresent] )
3337 }
3438
3539 // MARK: - Canada Tests
3640 func test_configuration_for_Canada_with_Stripe_enabled_Canada_enabled( ) throws {
37- let configuration = try CardPresentPaymentsConfiguration ( country: " CA " , stripeEnabled: true , canadaEnabled: true )
41+ let configuration = CardPresentPaymentsConfiguration ( country: " CA " , stripeEnabled: true , canadaEnabled: true )
42+ XCTAssertTrue ( configuration. isSupportedCountry)
3843 XCTAssertEqual ( configuration. currencies, [ Constants . Currency. cad] )
3944 XCTAssertEqual ( configuration. paymentGateways, [ Constants . PaymentGateway. wcpay] )
4045 XCTAssertEqual ( configuration. paymentMethods, [ . cardPresent, . interacPresent] )
4146 }
4247
4348 func test_configuration_for_Canada_with_Stripe_enabled_Canada_disabled( ) {
44- XCTAssertThrowsError ( try CardPresentPaymentsConfiguration ( country: " CA " , stripeEnabled: true , canadaEnabled: false ) )
49+ let configuration = CardPresentPaymentsConfiguration ( country: " CA " , stripeEnabled: true , canadaEnabled: false )
50+ XCTAssertFalse ( configuration. isSupportedCountry)
4551 }
4652
4753 func test_configuration_for_Canada_with_Stripe_disabled_Canada_enabled( ) throws {
48- let configuration = try CardPresentPaymentsConfiguration ( country: " CA " , stripeEnabled: false , canadaEnabled: true )
54+ let configuration = CardPresentPaymentsConfiguration ( country: " CA " , stripeEnabled: false , canadaEnabled: true )
55+ XCTAssertTrue ( configuration. isSupportedCountry)
4956 XCTAssertEqual ( configuration. currencies, [ Constants . Currency. cad] )
5057 XCTAssertEqual ( configuration. paymentGateways, [ Constants . PaymentGateway. wcpay] )
5158 XCTAssertEqual ( configuration. paymentMethods, [ . cardPresent, . interacPresent] )
5259 }
5360
5461 func test_configuration_for_Canada_with_Stripe_disabled_Canada_disabled( ) throws {
55- XCTAssertThrowsError ( try CardPresentPaymentsConfiguration ( country: " CA " , stripeEnabled: false , canadaEnabled: false ) )
62+ let configuration = CardPresentPaymentsConfiguration ( country: " CA " , stripeEnabled: false , canadaEnabled: false )
63+ XCTAssertFalse ( configuration. isSupportedCountry)
5664 }
5765
5866 private enum Constants {
0 commit comments