Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
davidme-stripe committed Jan 3, 2025
1 parent 77579c0 commit 14fc9f7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class PaymentSheetLinkAccount: PaymentSheetLinkAccountInfoProtocol {

/// Publishable key of the Consumer Account.
private(set) var publishableKey: String?

var paymentSheetLinkAccountDelegate: PaymentSheetLinkAccountDelegate?

let email: String
Expand Down Expand Up @@ -246,7 +246,7 @@ class PaymentSheetLinkAccount: PaymentSheetLinkAccountInfoProtocol {
)
return
}

session.createLinkAccountSession(
consumerAccountPublishableKey: publishableKey,
completion: completionWrapper
Expand Down Expand Up @@ -286,7 +286,7 @@ class PaymentSheetLinkAccount: PaymentSheetLinkAccountInfoProtocol {
completion(.failure(PaymentSheetError.unknown(debugDescription: "Saving to Link without valid session")))
return
}

session.createPaymentDetails(
linkedAccountId: linkedAccountId,
consumerAccountPublishableKey: publishableKey,
Expand Down Expand Up @@ -325,7 +325,7 @@ class PaymentSheetLinkAccount: PaymentSheetLinkAccountInfoProtocol {
)
)
}

session.deletePaymentDetails(
with: apiClient,
id: id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ extension PayWithLinkViewController: PaymentSheetLinkAccountDelegate {
}
}
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

import XCTest

import OHHTTPStubs
import OHHTTPStubsSwift
@testable@_spi(STP) import StripeCore
@testable@_spi(STP) import StripeCoreTestUtils
@testable@_spi(STP) import StripePayments
@testable@_spi(STP) import StripePaymentSheet
@testable@_spi(STP) import StripePaymentsTestUtils
@testable@_spi(STP) import StripePaymentsUI
@testable@_spi(STP) import StripeCoreTestUtils
import OHHTTPStubs
import OHHTTPStubsSwift

final class PaymentSheetLinkAccountTests: APIStubbedTestCase {

Expand Down Expand Up @@ -49,7 +49,7 @@ final class PaymentSheetLinkAccountTests: APIStubbedTestCase {
]
)
}

func testRefreshesWhenNeeded() {
let sut = makeSUT()
let listedPaymentDetailsExp = expectation(description: "Lists payment details")
Expand Down Expand Up @@ -77,7 +77,7 @@ final class PaymentSheetLinkAccountTests: APIStubbedTestCase {
let paymentDetailsEmptyList = ["redacted_payment_details": []]
return HTTPStubsResponse(jsonObject: paymentDetailsEmptyList, statusCode: 200, headers: nil)
}

sut.paymentSheetLinkAccountDelegate = PaymentSheetLinkAccountDelegateStub(expectation: refreshExp)
// List the payment details. This will fail, refresh the token, then succeed.
sut.listPaymentDetails { result in
Expand All @@ -95,11 +95,11 @@ final class PaymentSheetLinkAccountTests: APIStubbedTestCase {

class PaymentSheetLinkAccountDelegateStub: PaymentSheetLinkAccountDelegate {
let expectation: XCTestExpectation

init(expectation: XCTestExpectation) {
self.expectation = expectation
}

func refreshLinkSession(completion: @escaping (Result<ConsumerSession, Error>) -> Void) {
// Return a fake session with a "good" key
let stubSession = ConsumerSession(
Expand Down

0 comments on commit 14fc9f7

Please sign in to comment.