Skip to content

Commit

Permalink
Improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
vikmeup committed Jul 23, 2018
1 parent de7eb9e commit 75e80e3
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
9 changes: 0 additions & 9 deletions Trust.xcodeproj/xcshareddata/xcschemes/Trust.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,9 @@
<Test
Identifier = "GetNonceProviderTests">
</Test>
<Test
Identifier = "InCoordinatorTests">
</Test>
<Test
Identifier = "InitialWalletCreationCoordinatorTests">
</Test>
<Test
Identifier = "SendViewModelTest">
</Test>
<Test
Identifier = "TokensDataStoreTest">
</Test>
<Test
Identifier = "TypedMessageEncodingTests">
</Test>
Expand Down
4 changes: 2 additions & 2 deletions TrustTests/Coordinators/InCoordinatorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class InCoordinatorTests: XCTestCase {
XCTAssertNotNil(tabbarController)

XCTAssert((tabbarController?.viewControllers?[0] as? UINavigationController)?.viewControllers[0] is MasterBrowserViewController)
XCTAssert((tabbarController?.viewControllers?[1] as? UINavigationController)?.viewControllers[0] is TokensViewController)
XCTAssert((tabbarController?.viewControllers?[1] as? UINavigationController)?.viewControllers[0] is WalletViewController)
XCTAssert((tabbarController?.viewControllers?[2] as? UINavigationController)?.viewControllers[0] is SettingsViewController)
}

Expand Down Expand Up @@ -103,6 +103,6 @@ class InCoordinatorTests: XCTestCase {

let viewController = (coordinator.tabBarController?.selectedViewController as? UINavigationController)?.viewControllers[0]

XCTAssert(viewController is TokensViewController)
XCTAssert(viewController is WalletViewController)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class InitialWalletCreationCoordinatorTests: XCTestCase {

coordinator.start()

XCTAssertTrue((coordinator.navigationController.presentedViewController as? NavigationController)?.viewControllers[0] is ImportWalletViewController)
XCTAssertTrue((coordinator.navigationController.presentedViewController as? NavigationController)?.viewControllers[0] is ImportMainWalletViewController)
}

//TODO. Create unit test when you have already main wallet imported
}
6 changes: 4 additions & 2 deletions TrustTests/Factories/Wallet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ extension Wallet {
}

static func make(
keyURL: URL = URL(fileURLWithPath: ""),
key: KeystoreKey = Wallet.k()
) -> Wallet {
let datadir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
let url = URL(fileURLWithPath: datadir + "/k/test.json")

let wallet = Wallet(
keyURL: URL(fileURLWithPath: ""),
keyURL: url,
key: key
)
let _ = try! wallet.getAccount(password: "hello")
Expand Down
2 changes: 1 addition & 1 deletion TrustTests/Factories/WalletInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Foundation
extension WalletInfo {
static func make(
type: WalletType = WalletType.privateKey(.make()),
info: WalletObject = WalletObject()
info: WalletObject = WalletObject.from(WalletType.privateKey(.make()))
) -> WalletInfo {
return WalletInfo(
type: type,
Expand Down
2 changes: 1 addition & 1 deletion TrustTests/Tokens/TokensDataStoreTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ class TokensDataStoreTest: XCTestCase {

let coinTicker = tokensDataStore.coinTicker(for: token)

XCTAssertEqual("0x0000000000000000000000000000000000000001_tickers-USD-1", coinTicker?.key)
XCTAssertEqual("0x0000000000000000000000000000000000000001_tickers-USD", coinTicker?.key)
}
}

0 comments on commit 75e80e3

Please sign in to comment.