Browse Source

Apply SwiftLint

pull/1/head
InKwon James Kim 5 years ago
parent
commit
2e779ba116
  1. 4
      GME Remit.xcodeproj/project.pbxproj
  2. 100
      GME RemitTests/APITest.swift
  3. 8
      GME RemitTests/DatabaseTest.swift
  4. 36
      GME RemitTests/KeychainTest.swift

4
GME Remit.xcodeproj/project.pbxproj

@ -14918,7 +14918,7 @@
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 5QB497ZAGT;
INFOPLIST_FILE = GMERemittanceTests/Info.plist;
INFOPLIST_FILE = "GME RemitTests/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.gmeremit.online.GMERemittanceTests;
@ -14937,7 +14937,7 @@
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 5QB497ZAGT;
INFOPLIST_FILE = GMERemittanceTests/Info.plist;
INFOPLIST_FILE = "GME RemitTests/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.gmeremit.online.GMERemittanceTests;

100
GME RemitTests/APITest.swift

@ -10,51 +10,58 @@ 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()
})
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)
}
wait(for: [expt], timeout: 5.0)
}
func testFetchBankList(){
let service = AddAccountService()
let expt = expectation(description: "testFetchBankList")
func testFetchBankList() {
let service = AddAccountService()
let expt = expectation(description: "testFetchBankList")
service.fetchBankList(success: {
print("banks: \($0)")
expt.fulfill()
}){
print("error: \($0)")
expt.fulfill()
}
wait(for: [expt], timeout: 5.0)
service.fetchBankList(
success: {
print("banks: \($0)")
expt.fulfill()
},
failure: {
print("error: \($0)")
expt.fulfill()
}
)
func testRealName(){
let service = AddAccountService()
let expt = expectation(description: "testRealName")
wait(for: [expt], timeout: 5.0)
}
var params = ["CustomerId": "85074"]
params["BankCode"] = "034"
params["AccountNumber"] = "1234512345"
func testRealName() {
let service = AddAccountService()
let expt = expectation(description: "testRealName")
service.verifyAccountService(params: params, success: {
expt.fulfill()
}) {
print("error: \($0)")
expt.fulfill()
}
wait(for: [expt], timeout: 5.0)
}
var params = ["CustomerId": "85074"]
params["BankCode"] = "034"
params["AccountNumber"] = "1234512345"
service.verifyAccountService(
params: params,
success: {
expt.fulfill()
},
failure: {
print("error: \($0)")
expt.fulfill()
}
)
wait(for: [expt], timeout: 5.0)
}
func testFetchOrderHistory() {
let service = OrderHistoryService()
@ -68,14 +75,15 @@ class APITest: XCTestCase {
},
failure: { _ in
expt.fulfill()
})
}
)
wait(for: [expt], timeout: 5.0)
}
func testFetchHotLines(){
// let service = HomeService()
// service.fetchHotLines()
func testFetchHotLines() {
// let service = HomeService()
// service.fetchHotLines()
}
func testKFTCRefrsh() {
@ -98,17 +106,17 @@ class APITest: XCTestCase {
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)

8
GME RemitTests/DatabaseTest.swift

@ -84,10 +84,10 @@ class DatabaseTest: XCTestCase {
XCTAssert(GMEDB.shared.user.string(.availableBalance) == Optional("0"))
XCTAssert(GMEDB.shared.user.string(.country) == Optional(""))
XCTAssert(GMEDB.shared.user.string(.ErrorCode) == nil)
XCTAssert(GMEDB.shared.user.string(.errorCode) == nil)
XCTAssert(GMEDB.shared.user.string(.pennyTestStatusCode) == Optional("0"))
XCTAssert(GMEDB.shared.user.string(.firstName) == Optional("iosDemo@gmeremit.com"))
XCTAssert(GMEDB.shared.user.string(.Data) == nil)
XCTAssert(GMEDB.shared.user.string(.data) == nil)
XCTAssert(GMEDB.shared.user.string(.yearlyLimit) == Optional("30,000"))
XCTAssert(GMEDB.shared.user.string(.dateOfBirth) == Optional("1988-03-27"))
XCTAssert(GMEDB.shared.user.string(.senderId) == Optional("17"))
@ -102,10 +102,10 @@ class DatabaseTest: XCTestCase {
XCTAssert(GMEDB.shared.user.string(.availableBalance) == nil)
XCTAssert(GMEDB.shared.user.string(.country) == nil)
XCTAssert(GMEDB.shared.user.string(.ErrorCode) == nil)
XCTAssert(GMEDB.shared.user.string(.errorCode) == nil)
XCTAssert(GMEDB.shared.user.string(.pennyTestStatusCode) == nil)
XCTAssert(GMEDB.shared.user.string(.firstName) == nil)
XCTAssert(GMEDB.shared.user.string(.Data) == nil)
XCTAssert(GMEDB.shared.user.string(.data) == nil)
XCTAssert(GMEDB.shared.user.string(.yearlyLimit) == nil)
XCTAssert(GMEDB.shared.user.string(.dateOfBirth) == nil)
XCTAssert(GMEDB.shared.user.string(.senderId) == nil)

36
GME RemitTests/KeychainTest.swift

@ -11,26 +11,26 @@ import KeychainAccess
@testable import GME_Remit
class KeychainTest: XCTestCase {
func testSave(){
KeyChain.shared.save(data: "ubrai13@gmail.com", key: .id)
KeyChain.shared.save(data: "111111", key: .password)
KeyChain.shared.save(data: "0", key: .biometricAuth)
}
func testSave() {
KeyChain.shared.save(data: "ubrai13@gmail.com", key: .id)
KeyChain.shared.save(data: "111111", key: .password)
KeyChain.shared.save(data: "0", key: .biometricAuth)
}
func testFetch(){
XCTAssert(KeyChain.shared.get(key: .id) == "ubrai13@gmail.com")
XCTAssert(KeyChain.shared.get(key: .password) == "111111")
XCTAssert(KeyChain.shared.get(key: .biometricAuth) == "0")
}
func testFetch() {
XCTAssert(KeyChain.shared.get(key: .id) == "ubrai13@gmail.com")
XCTAssert(KeyChain.shared.get(key: .password) == "111111")
XCTAssert(KeyChain.shared.get(key: .biometricAuth) == "0")
}
func testRemove(){
KeyChain.shared.remove(key: .biometricAuth)
KeyChain.shared.remove(key: .id)
KeyChain.shared.remove(key: .password)
}
func testRemove() {
KeyChain.shared.remove(key: .biometricAuth)
KeyChain.shared.remove(key: .id)
KeyChain.shared.remove(key: .password)
}
func testRemoveAll(){
KeyChain.shared.removeAll()
}
func testRemoveAll() {
KeyChain.shared.removeAll()
}
}
Loading…
Cancel
Save