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.

82 lines
2.0 KiB

5 years ago
5 years ago
  1. //
  2. // APITest.swift
  3. // GMERemittanceTests
  4. //
  5. // Created by InKwon Devik Kim on 03/05/2019.
  6. // Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import XCTest
  9. @testable import GME_Remit
  10. class APITest: XCTestCase {
  11. func testProductList(){
  12. let service = RewardService()
  13. let expt = expectation(description: "ProductList")
  14. service.fetchProductList(success: {
  15. print("success: \($0?.count ?? 0)")
  16. expt.fulfill()
  17. }, failure: {
  18. print("Error: \($0.localizedDescription)")
  19. expt.fulfill()
  20. })
  21. wait(for: [expt], timeout: 5.0)
  22. }
  23. func testFetchBankList(){
  24. let service = AddAccountService()
  25. let expt = expectation(description: "testFetchBankList")
  26. service.fetchBankList(success: {
  27. print("banks: \($0)")
  28. expt.fulfill()
  29. }){
  30. print("error: \($0)")
  31. expt.fulfill()
  32. }
  33. wait(for: [expt], timeout: 5.0)
  34. }
  35. func testRealName(){
  36. let service = AddAccountService()
  37. let expt = expectation(description: "testRealName")
  38. var params = ["CustomerId": "85074"]
  39. params["BankCode"] = "034"
  40. params["AccountNumber"] = "1234512345"
  41. service.verifyAccountService(params: params, success: {
  42. expt.fulfill()
  43. }) {
  44. print("error: \($0)")
  45. expt.fulfill()
  46. }
  47. wait(for: [expt], timeout: 5.0)
  48. }
  49. func testFetchOrderHistory() {
  50. let service = OrderHistoryService()
  51. let expt = expectation(description: "testFetchOrderHistory")
  52. service.fetchOrderHistory(
  53. from: "2019-05-01",
  54. to: "2019-05-11",
  55. success: {
  56. print("response: \($0)")
  57. expt.fulfill()
  58. },
  59. failure: {
  60. print("error: \($0)")
  61. expt.fulfill()
  62. })
  63. wait(for: [expt], timeout: 5.0)
  64. }
  65. func testFetchHotLines(){
  66. let service = HomeService()
  67. service.fetchHotLines()
  68. }
  69. }