You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

188 lines
4.4 KiB

//
// APITest.swift
// GMERemittanceTests
//
// Created by InKwon Devik Kim on 03/05/2019.
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
//
import XCTest
@testable import GME_Remit
class APITest: XCTestCase {
func testProductList() {
let service = RewardService()
let expt = expectation(description: "ProductList")
service.fetchProductList(success: {
print("success: \($0?.count ?? 0)")
expt.fulfill()
}, failure: {
print("Error: \($0.localizedDescription)")
expt.fulfill()
})
wait(for: [expt], timeout: 5.0)
}
func testFetchBankList() {
let service = AddAccountService()
let expt = expectation(description: "testFetchBankList")
service.fetchBankList(
success: {
print("banks: \($0?.count ?? 0)")
expt.fulfill()
},
failure: {
print("error: \($0.localizedDescription)")
expt.fulfill()
}
)
wait(for: [expt], timeout: 5.0)
}
func testRealName() {
// let service = AddAccountService()
// let expt = expectation(description: "testRealName")
//
// var params = ["CustomerId": "85074"]
// params["BankCode"] = "034"
// params["AccountNumber"] = "1234512345"
//
// service.verifyAccountService(
// using: params,
// success: {
// expt.fulfill()
// },
// failure: {
// print("error: \($0)")
// expt.fulfill()
// }
// )
// wait(for: [expt], timeout: 5.0)
}
func testFetchOrderHistory() {
let service = OrderHistoryService()
let expt = expectation(description: "testFetchOrderHistory")
service.fetchOrderHistory(
from: "2019-05-01",
to: "2019-05-11",
success: { _ in
expt.fulfill()
},
failure: { _ in
expt.fulfill()
}
)
wait(for: [expt], timeout: 5.0)
}
func testFetchHotLines() {
// let service = HomeService()
// service.fetchHotLines()
}
func testKFTCRefrsh() {
let service = AutoDebitService()
let service2 = AddAccountService()
let expt = expectation(description: "Test KFTC Refresh")
service.refreshTokenStep1(
username: "maxkim@gmeremit.com",
success: {
let url = "\($0?.url?.replacingOccurrences(of: "&lang=", with: "&lang=kor") ?? "")"
var header = [String: String]()
$0?.header?.forEach({
header[$0.key ?? ""] = $0.value ?? ""
})
service2.fetchKftcUrlService(
url: url,
header: header,
success: {
print("Fetched URL: \($0 ?? "URL IS NULL")")
expt.fulfill()
},
failure: {
print("Fetch URL Error: \($0)")
expt.fulfill()
}
)
},
failure: {
print("Error: \($0)")
expt.fulfill()
}
)
wait(for: [expt], timeout: 60)
}
func testFetchCountryService() {
// let expt = expectation(description: "testDynamicReceiver")
// let service = SetupRecipientService()
}
func testDynamicReceiver() {
let expt = expectation(description: "testDynamicReceiver")
let service = SetupRecipientService()
service.fetchDynamicReceiverFields(
of: "104",
paymentModeID: "2",
success: {
print($0.dynamicField)
expt.fulfill()
},
failure: {
XCTAssert(false, $0.localizedDescription)
expt.fulfill()
}
)
wait(for: [expt], timeout: 5.0)
}
func testFecthRecipients() {
let expt = expectation(description: "testFecthRecipients")
let service = RecipientsService()
service.fetchRecipients(
success: {
print($0.accounts?.count ?? 0)
print($0.recipients?.count ?? 0)
XCTAssert(true)
expt.fulfill()
},
failure: {
XCTAssert(false, $0.localizedDescription)
expt.fulfill()
}
)
wait(for: [expt], timeout: 1000.0)
}
func testFetchBranch() {
let expt = expectation(description: "textFetchBranch")
let service = TablePresenterService()
service.fetchBranches(
countryCode: "",
bankID: "",
branchName: "",
success: {
print($0.count)
expt.fulfill()
XCTAssert(true)
},
failure: {
expt.fulfill()
XCTAssert(false, $0.localizedDescription)
})
wait(for: [expt], timeout: 5.0)
}
}