An advanced Ethereum/EVM mobile wallet
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.
 
 
 
alpha-wallet-ios/AlphaWalletTests/Coordinators/WalletCoordinatorTests.swift

70 lines
2.1 KiB

// Copyright SIX DAY LLC. All rights reserved.
import XCTest
@testable import AlphaWallet
import AlphaWalletFoundation
class WalletCoordinatorTests: XCTestCase {
func testImportWallet() {
let coordinator = WalletCoordinator(
config: .make(),
navigationController: FakeNavigationController(),
keystore: FakeEtherKeystore(),
analytics: FakeAnalyticsService(),
domainResolutionService: FakeDomainResolutionService()
)
coordinator.start(.importWallet(params: nil))
XCTAssertTrue(coordinator.navigationController.viewControllers[0] is ImportWalletViewController)
}
func testCreateInstantWallet() {
let delegate = FakeWalletCoordinatorDelegate()
let coordinator = WalletCoordinator(
config: .make(),
navigationController: FakeNavigationController(),
keystore: FakeEtherKeystore(),
analytics: FakeAnalyticsService(),
domainResolutionService: FakeDomainResolutionService()
)
coordinator.delegate = delegate
XCTAssertFalse(coordinator.start(.createInstantWallet))
}
func testPushImportWallet() {
let coordinator = WalletCoordinator(
config: .make(),
navigationController: FakeNavigationController(),
keystore: FakeEtherKeystore(),
analytics: FakeAnalyticsService(),
domainResolutionService: FakeDomainResolutionService()
)
coordinator.start(.addInitialWallet)
coordinator.pushImportWallet()
XCTAssertTrue(coordinator.navigationController.viewControllers[1] is ImportWalletViewController)
}
}
class FakeWalletCoordinatorDelegate: WalletCoordinatorDelegate {
var didFail: Error? = .none
var didFinishAccount: Wallet? = .none
var didCancel: Bool = false
func didCancel(in coordinator: WalletCoordinator) {
didCancel = true
}
func didFinish(with account: Wallet, in coordinator: WalletCoordinator) {
didFinishAccount = account
}
func didFail(with error: Error, in coordinator: WalletCoordinator) {
didFail = error
}
}