From 08224466d1e8983c36b6d89f1d96467db4aa9b02 Mon Sep 17 00:00:00 2001 From: Charlie Cruzan Date: Fri, 6 Jan 2023 16:29:11 -0500 Subject: [PATCH] fix unit tests again --- ios/Tests/ApplePayUtilsTests.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ios/Tests/ApplePayUtilsTests.swift b/ios/Tests/ApplePayUtilsTests.swift index e0220b12a..262abc3f8 100644 --- a/ios/Tests/ApplePayUtilsTests.swift +++ b/ios/Tests/ApplePayUtilsTests.swift @@ -15,7 +15,7 @@ class ApplePayUtilsTests: XCTestCase { func test_buildPaymentSheetApplePayConfig_FailsWithoutMerchantIdentifier() throws { XCTAssertThrowsError( - try ApplePayUtils.buildPaymentSheetApplePayConfig(merchantIdentifier: nil, merchantCountryCode: "", paymentSummaryItems: nil, buttonType: nil) + try ApplePayUtils.buildPaymentSheetApplePayConfig(merchantIdentifier: nil, merchantCountryCode: "", paymentSummaryItems: nil, buttonType: nil, customHandlers: nil) ) { error in XCTAssertEqual( error as! ApplePayUtilsError, ApplePayUtilsError.missingMerchantId @@ -25,7 +25,7 @@ class ApplePayUtilsTests: XCTestCase { func test_buildPaymentSheetApplePayConfig_FailsWithoutCountryCode() throws { XCTAssertThrowsError( - try ApplePayUtils.buildPaymentSheetApplePayConfig(merchantIdentifier: TestFixtures.MERCHANT_ID, merchantCountryCode: nil, paymentSummaryItems: nil, buttonType: nil) + try ApplePayUtils.buildPaymentSheetApplePayConfig(merchantIdentifier: TestFixtures.MERCHANT_ID, merchantCountryCode: nil, paymentSummaryItems: nil, buttonType: nil, customHandlers: nil) ) { error in XCTAssertEqual( error as! ApplePayUtilsError, ApplePayUtilsError.missingCountryCode @@ -34,13 +34,13 @@ class ApplePayUtilsTests: XCTestCase { } func test_buildPaymentSheetApplePayConfig_withNilAndEmptyArray_shouldBeEqual() throws { - let resultWithItemsAsNil = try ApplePayUtils.buildPaymentSheetApplePayConfig(merchantIdentifier: TestFixtures.MERCHANT_ID, merchantCountryCode: TestFixtures.COUNTRY_CODE, paymentSummaryItems: nil, buttonType: nil) - let resultWithItemsAsEmptyArray = try ApplePayUtils.buildPaymentSheetApplePayConfig(merchantIdentifier: TestFixtures.MERCHANT_ID, merchantCountryCode: TestFixtures.COUNTRY_CODE, paymentSummaryItems: [], buttonType: nil) + let resultWithItemsAsNil = try ApplePayUtils.buildPaymentSheetApplePayConfig(merchantIdentifier: TestFixtures.MERCHANT_ID, merchantCountryCode: TestFixtures.COUNTRY_CODE, paymentSummaryItems: nil, buttonType: nil, customHandlers: nil) + let resultWithItemsAsEmptyArray = try ApplePayUtils.buildPaymentSheetApplePayConfig(merchantIdentifier: TestFixtures.MERCHANT_ID, merchantCountryCode: TestFixtures.COUNTRY_CODE, paymentSummaryItems: [], buttonType: nil, customHandlers: nil) XCTAssertEqual(resultWithItemsAsNil.paymentSummaryItems, resultWithItemsAsEmptyArray.paymentSummaryItems) } func test_buildPaymentSheetApplePayConfig_withItems_shouldMatchExpected() throws { - let result = try ApplePayUtils.buildPaymentSheetApplePayConfig(merchantIdentifier: TestFixtures.MERCHANT_ID, merchantCountryCode: TestFixtures.COUNTRY_CODE, paymentSummaryItems: TestFixtures.CART_ITEM_DICTIONARY, buttonType: nil) + let result = try ApplePayUtils.buildPaymentSheetApplePayConfig(merchantIdentifier: TestFixtures.MERCHANT_ID, merchantCountryCode: TestFixtures.COUNTRY_CODE, paymentSummaryItems: TestFixtures.CART_ITEM_DICTIONARY, buttonType: nil, customHandlers: nil) let deferredItemResult = PKDeferredPaymentSummaryItem(label: "deferred label", amount: 1.00) deferredItemResult.deferredDate = Date(timeIntervalSince1970: 123456789) @@ -178,12 +178,12 @@ class ApplePayUtilsTests: XCTestCase { } func test_buildPaymentSheetApplePayConfig_withNilButtonType_shouldBePlain() throws { - let result = try ApplePayUtils.buildPaymentSheetApplePayConfig(merchantIdentifier: TestFixtures.MERCHANT_ID, merchantCountryCode: TestFixtures.COUNTRY_CODE, paymentSummaryItems: nil, buttonType: nil) + let result = try ApplePayUtils.buildPaymentSheetApplePayConfig(merchantIdentifier: TestFixtures.MERCHANT_ID, merchantCountryCode: TestFixtures.COUNTRY_CODE, paymentSummaryItems: nil, buttonType: nil, customHandlers: nil) XCTAssertEqual(result.buttonType, .plain) } func test_buildPaymentSheetApplePayConfig_withButtonType4_shouldBeDonate() throws { - let result = try ApplePayUtils.buildPaymentSheetApplePayConfig(merchantIdentifier: TestFixtures.MERCHANT_ID, merchantCountryCode: TestFixtures.COUNTRY_CODE, paymentSummaryItems: nil, buttonType: 4) + let result = try ApplePayUtils.buildPaymentSheetApplePayConfig(merchantIdentifier: TestFixtures.MERCHANT_ID, merchantCountryCode: TestFixtures.COUNTRY_CODE, paymentSummaryItems: nil, buttonType: 4, customHandlers: nil) XCTAssertEqual(result.buttonType, .donate) }