Skip to content

Commit

Permalink
add unit test for hitting generate_fi_url endpoint with correct reque…
Browse files Browse the repository at this point in the history
…st parms
  • Loading branch information
KunJeongPark committed Aug 21, 2024
1 parent a0b9731 commit ba9a21f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions UnitTests/BraintreePayPalTests/BTPayPalClient_Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,20 @@ class BTPayPalClient_Tests: XCTestCase {
}
}

func testEditFI_whenRemoteConfigurationFetchSucceeds_postsToCorrectEndpoint() {
let editRequest = BTPayPalVaultEditRequest(editPayPalVaultID: "test-ID")

payPalClient.edit(editRequest) { _, _ in }

XCTAssertEqual("v1/paypal_hermes/generate_edit_fi_url", mockAPIClient.lastPOSTPath)
guard let lastPostParameters = mockAPIClient.lastPOSTParameters else { XCTFail(); return }

XCTAssertEqual(lastPostParameters["edit_paypal_vault_id"] as? String, "test-ID")

XCTAssertEqual(lastPostParameters["return_url"] as? String, "sdk.ios.braintree://onetouch/v1/success")
XCTAssertEqual(lastPostParameters["cancel_url"] as? String, "sdk.ios.braintree://onetouch/v1/cancel")
}

// MARK: - PayPal approval URL to present in browser

func testTokenizePayPalAccount_checkout_whenUserActionIsNotSet_approvalUrlIsNotModified() {
Expand Down

0 comments on commit ba9a21f

Please sign in to comment.