-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Amex UI tests w/ Integration Tests (save 45s on CI!) (#1459)
- Loading branch information
Showing
4 changed files
with
35 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
Demo/UI Tests/American Express UI Tests/AmericanExpress_UITests.swift
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
IntegrationTests/BraintreeAmexExpress_IntegrationTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import XCTest | ||
@testable import BraintreeAmericanExpress | ||
@testable import BraintreeCard | ||
@testable import BraintreeCore | ||
|
||
class BraintreeAmexExpress_IntegrationTests: XCTestCase { | ||
|
||
func testGetRewardsBalance_returnsResult() async { | ||
let apiClient = BTAPIClient(authorization: BTIntegrationTestsConstants.sandboxClientTokenVersion3)! | ||
let cardClient = BTCardClient(apiClient: apiClient) | ||
let amexClient = BTAmericanExpressClient(apiClient: apiClient) | ||
|
||
let card = BTCard() | ||
card.number = "371260714673002" | ||
card.expirationMonth = "12" | ||
card.expirationYear = Helpers.shared.futureYear() | ||
card.cvv = "1234" | ||
|
||
do { | ||
let tokenizedCard = try await cardClient.tokenize(card) | ||
let rewardsBalance = try await amexClient.getRewardsBalance(forNonce: tokenizedCard.nonce, currencyISOCode: "USD") | ||
|
||
XCTAssertEqual(rewardsBalance.rewardsAmount, "45256433") | ||
XCTAssertEqual(rewardsBalance.rewardsUnit, "Points") | ||
XCTAssertEqual(rewardsBalance.currencyAmount, "316795.03") | ||
XCTAssertEqual(rewardsBalance.currencyIsoCode, "USD") | ||
} catch { | ||
XCTFail("Unexpected error: \(error.localizedDescription)") | ||
} | ||
} | ||
} |