Skip to content

Commit

Permalink
Merge branch 'develop' into release/5.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
goergisn authored Jan 26, 2024
2 parents 96a0139 + 68f5db1 commit 5fbdf00
Showing 1 changed file with 39 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ class AdyenActionComponentTests: XCTestCase {
"type" : "voucher"
}
"""

let qrAction = """
{
"paymentMethodType": "upi_qr",
"qrCodeData": "QR_CODE_DATA",
"paymentData": ""
}
"""

let documentAction = """
{
"paymentMethodType": "directdebit_GB",
"url": "https://adyen.com"
}
"""

func testRedirectToHttpWebLink() throws {
let sut = AdyenActionComponent(context: Dummy.context)
Expand Down Expand Up @@ -118,13 +133,7 @@ class AdyenActionComponentTests: XCTestCase {
let action = try! JSONDecoder().decode(ThreeDS2Action.self, from: threeDSFingerprintAction.data(using: .utf8)!)
sut.handle(Action.threeDS2(action))

let waitExpectation = expectation(description: "Expect in app browser to be presented and then dismissed")
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + .seconds(2)) {
XCTAssertNotNil(sut.currentActionComponent as? ThreeDS2Component)
waitExpectation.fulfill()
}

waitForExpectations(timeout: 10, handler: nil)
wait { sut.currentActionComponent is ThreeDS2Component }
}

func testVoucherAction() throws {
Expand All @@ -146,4 +155,27 @@ class AdyenActionComponentTests: XCTestCase {

waitForExpectations(timeout: 100, handler: nil)
}

func testQRCodeAction() throws {

let sut = AdyenActionComponent(context: Dummy.context)
sut.presentationDelegate = try UIViewController.topPresenter()

let action = try! JSONDecoder().decode(QRCodeAction.self, from: qrAction.data(using: .utf8)!)
sut.handle(Action.qrCode(action))

try waitUntilTopPresenter(isOfType: QRCodeViewController.self)
}

func testDocumentAction() throws {
// DocumentAction
let sut = AdyenActionComponent(context: Dummy.context)
sut.presentationDelegate = try UIViewController.topPresenter()

let action = try! JSONDecoder().decode(DocumentAction.self, from: documentAction.data(using: .utf8)!)
sut.handle(Action.document(action))

let documentViewController = try waitUntilTopPresenter(isOfType: ADYViewController.self)
XCTAssertNotNil(documentViewController.view as? DocumentActionView)
}
}

0 comments on commit 5fbdf00

Please sign in to comment.