Skip to content

Commit

Permalink
HUC test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jnewc committed Apr 19, 2024
1 parent 8e63aaf commit e08bbb1
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ final class HUC_TokenizationViewModelTests: XCTestCase {
private var isImplementingPaymentMethodWithRequiredAction = false
private var abortPayment = false

var onCreatePaymentWithData: ((PrimerCheckoutPaymentMethodData) -> Void)?

override func tearDown() {
VaultService.apiClient = nil
PrimerAPIConfigurationModule.apiClient = nil
Expand Down Expand Up @@ -404,7 +406,8 @@ final class HUC_TokenizationViewModelTests: XCTestCase {
}

if self.abortPayment {
DispatchQueue.main.asyncAfter(deadline: .now() + 8) {
onCreatePaymentWithData = { _ in

print(self.eventsCalled)

if isSurchargeIncluded {
Expand Down Expand Up @@ -483,6 +486,7 @@ extension HUC_TokenizationViewModelTests: PrimerHeadlessUniversalCheckoutDelegat

func primerHeadlessUniversalCheckoutWillCreatePaymentWithData(_ data: PrimerCheckoutPaymentMethodData, decisionHandler: @escaping (PrimerPaymentCreationDecision) -> Void) {
eventsCalled.append("primerHeadlessUniversalCheckoutWillCreatePaymentWithData")
onCreatePaymentWithData?(data)

if self.abortPayment {
decisionHandler(.abortPaymentCreation())
Expand Down

0 comments on commit e08bbb1

Please sign in to comment.