Skip to content

Commit

Permalink
fix test post rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
mludowise-stripe committed Sep 23, 2024
1 parent cf3cbc1 commit 3b2a624
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,26 @@ import WebKit
import XCTest

class PaymentDetailsViewControllerTests: XCTestCase {
func testLoadDidFail() {
@MainActor
func testDelegate() async throws {
STPAPIClient.shared.publishableKey = "pk_test"
let componentManager = EmbeddedComponentManager(fetchClientSecret: {
return nil
})
let vc = componentManager.createPaymentDetailsViewController()

let expectation = XCTestExpectation(description: "loadDidFail called")
let expectationDidFail = XCTestExpectation(description: "loadDidFail called")

let paymentDetailsDelegate = PaymentDetailsViewControllerDelegatePassThrough { _, error in
XCTAssertEqual((error as? EmbeddedComponentError)?.type, .rateLimitError)
XCTAssertEqual((error as? EmbeddedComponentError)?.description, "Error message")
expectation.fulfill()
expectationDidFail.fulfill()
}
vc.delegate = paymentDetailsDelegate

vc.webView.evaluateOnLoadError(type: "rate_limit_error", message: "Error message")
try await vc.webView.evaluateOnLoadError(type: "rate_limit_error", message: "Error message")

wait(for: [expectation], timeout: TestHelpers.defaultTimeout)
await fulfillment(of: [expectationDidFail], timeout: TestHelpers.defaultTimeout)
}

func testSetPayment() throws {
Expand Down

0 comments on commit 3b2a624

Please sign in to comment.