Refactor: rename func to be more intention revealing

pull/2209/head
Hwee-Boon Yar 4 years ago
parent f4ab19410a
commit b0f096465a
  1. 2
      AlphaWallet/Transfer/Controllers/TransactionConfigurator.swift
  2. 2
      AlphaWallet/Transfer/Coordinators/TransferNFTCoordinator.swift
  3. 2
      AlphaWallet/Transfer/ViewControllers/ConfirmPaymentViewController.swift
  4. 20
      AlphaWalletTests/Transfer/Controllers/TransactionConfiguratorTests.swift

@ -152,7 +152,7 @@ class TransactionConfigurator {
}
// swiftlint:disable function_body_length
func load(completion: @escaping (ResultResult<Void, AnyError>.t) -> Void) {
func start(completion: @escaping (ResultResult<Void, AnyError>.t) -> Void) {
switch transaction.transferType {
case .dapp:
configuration = TransactionConfiguration(

@ -90,7 +90,7 @@ class TransferNFTCoordinator: Coordinator {
account: account,
transaction: transaction
)
configurator.load { [weak self] result in
configurator.start { [weak self] result in
guard let strongSelf = self else {
return
}

@ -89,7 +89,7 @@ class ConfirmPaymentViewController: UIViewController {
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
configurator.load { [weak self] result in
configurator.start { [weak self] result in
guard let strongSelf = self else { return }
switch result {
case .success:

@ -8,34 +8,34 @@ class TransactionConfiguratorTests: XCTestCase {
func testDefault() {
let configurator = TransactionConfigurator(session: .make(), account: .make(), transaction: .make(gasLimit: BigInt(90000), gasPrice: .none))
XCTAssertEqual(GasPriceConfiguration.defaultPrice, configurator.configuration.gasPrice)
}
func testAdjustGasPrice() {
let desiderGasPrice = BigInt(1000000000)
let configurator = TransactionConfigurator(session: .make(), account: .make(), transaction: .make(gasPrice: desiderGasPrice))
XCTAssertEqual(desiderGasPrice, configurator.configuration.gasPrice)
}
func testMinGasPrice() {
let configurator = TransactionConfigurator(session: .make(), account: .make(), transaction: .make(gasPrice: BigInt(1)))
XCTAssertEqual(GasPriceConfiguration.minPrice, configurator.configuration.gasPrice)
}
func testMaxGasPrice() {
let configurator = TransactionConfigurator(session: .make(), account: .make(), transaction: .make(gasPrice: BigInt(990000000000)))
XCTAssertEqual(GasPriceConfiguration.maxPrice, configurator.configuration.gasPrice)
}
func testLoadEtherConfiguration() {
let configurator = TransactionConfigurator(session: .make(), account: .make(), transaction: .make(gasLimit: BigInt(50000), gasPrice: .none))
configurator.load { _ in }
configurator.start { _ in }
XCTAssertEqual(BigInt(GasPriceConfiguration.defaultPrice), configurator.configuration.gasPrice)
//gas limit is always 21k for native ether transfers
XCTAssertEqual(BigInt(21000), configurator.configuration.gasLimit)

Loading…
Cancel
Save