Merge pull request #555 from James-Sangalli/reduce-build-warnings

Reduce build warnings
pull/558/head
James Sangalli 6 years ago committed by GitHub
commit e69854fcd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .swiftlint.yml
  2. 2
      AlphaWallet/Accounts/Views/AccountViewCell.swift
  3. 4
      AlphaWallet/AppDelegate.swift
  4. 7
      AlphaWallet/AssetDefinition/AssetAttribute.swift
  5. 8
      AlphaWallet/AssetDefinition/AssetDefinitionDiskBackingStore.swift
  6. 2
      AlphaWallet/AssetDefinition/AssetDefinitionDiskBackingStoreWithOverrides.swift
  7. 2
      AlphaWallet/AssetDefinition/AssetDefinitionStore.swift
  8. 8
      AlphaWallet/AssetDefinition/DirectoryContentsWatcher.swift
  9. 2
      AlphaWallet/AssetDefinition/GeneralisedTime.swift
  10. 2
      AlphaWallet/EtherClient/EtherKeystore.swift
  11. 2
      AlphaWallet/EtherClient/Keystore.swift
  12. 3
      AlphaWallet/Market/Coordinators/UniversalLinkCoordinator.swift
  13. 2
      AlphaWallet/Redeem/ViewModels/TicketRowViewModel.swift
  14. 2
      AlphaWallet/Redeem/Views/TicketRowView.swift
  15. 2
      AlphaWallet/Settings/Coordinators/HelpUsCoordinator.swift
  16. 2
      AlphaWallet/Settings/Types/Config.swift
  17. 30
      AlphaWallet/Tokens/Coordinators/GetContractInteractions.swift
  18. 9
      AlphaWallet/Tokens/Coordinators/TokensCoordinator.swift
  19. 2
      AlphaWallet/Tokens/Types/TokenObject.swift
  20. 6
      AlphaWallet/Tokens/Types/TokensDataStore.swift
  21. 20
      AlphaWallet/Tokens/ViewControllers/NewTokenViewController.swift
  22. 29
      AlphaWallet/Transfer/Controllers/TransactionConfigurator.swift
  23. 4
      AlphaWallet/Transfer/Coordinators/TransferTicketsCoordinator.swift
  24. 1
      AlphaWallet/Transfer/ViewControllers/TransferTicketsQuantitySelectionViewController.swift
  25. 6
      AlphaWallet/Transfer/ViewModels/SendHeaderViewViewModel.swift
  26. 2
      AlphaWallet/Wallet/Coordinators/WalletCoordinator.swift
  27. 10
      AlphaWalletTests/AssetDefinition/AssetDefinitionStoreTests.swift
  28. 3
      AlphaWalletTests/Coordinators/ClaimOrderCoordinatorTests.swift
  29. 1
      AlphaWalletTests/Coordinators/SplashCoordinatorTests.swift
  30. 2
      AlphaWalletTests/EtherClient/EtherKeystoreTests.swift
  31. 2
      AlphaWalletTests/EtherClient/RLPTests.swift
  32. 3
      AlphaWalletTests/Factories/Account.swift
  33. 6
      AlphaWalletTests/Factories/FakeKeystore.swift
  34. 2
      AlphaWalletTests/Foundation/EtherNumberFormatterTests.swift
  35. 5
      AlphaWalletTests/Market/MarketQueueHandlerTests.swift
  36. 16
      AlphaWalletTests/Market/OrderSigningTests.swift
  37. 2
      AlphaWalletTests/Transactions/New Group/TransactionViewModelTests.swift
  38. 2
      AlphaWalletTests/Transfer/ViewControllers/TransferTicketsQuantitySelectionViewControllerTests.swift

@ -22,6 +22,7 @@ opt_in_rules:
- multiline_parameters
included:
- AlphaWallet
- AlphaWalletTests
excluded:
- AlphaWallet/Vendors
- AlphaWallet/R.generated.swift
@ -30,7 +31,7 @@ function_parameter_count:
error: 25
line_length:
warning: 250
error: 450
error: 600
large_tuple:
warning: 4
function_body_length: 80

@ -16,7 +16,7 @@ class AccountViewCell: UITableViewCell {
var addressLabel = UILabel()
var balanceLabel = UILabel()
weak var delegate: AccountViewCellDelegate?
var account: Wallet? = nil
var account: Wallet?
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)

@ -56,7 +56,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
}
// Respond to URI scheme links
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {
return true
}
@ -72,7 +72,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
return true
}
private func handleUniversalLink(url: URL) -> Bool {
@discardableResult private func handleUniversalLink(url: URL) -> Bool {
appCoordinator.createInitialWallet()
appCoordinator.closeWelcomeWindow()
universalLinkCoordinator = UniversalLinkCoordinator(config: Config())

@ -40,9 +40,8 @@ enum AssetAttribute {
init(attribute: XML.Element, lang: String) {
self = {
let attributeAccessor = XML.Accessor(attribute)
let attribute = XML.Accessor(attribute)
//TODO show error if syntax attribute is missing
if case .singleElement(let origin) = attributeAccessor["origin"], let rawSyntax = attributeAccessor.attributes["syntax"], let syntax = AssetAttributeSyntax(rawValue: rawSyntax), let type = XML.Accessor(origin).attributes["as"] {
if case .singleElement(let origin) = attributeAccessor["origin"], let rawSyntax = attributeAccessor.attributes["syntax"], let syntax = AssetAttributeSyntax(rawValue: rawSyntax), let type = XML.Accessor(origin).attributes["as"] {
switch type {
case "mapping":
return .mapping(attribute: attributeAccessor, syntax: syntax, lang: lang)
@ -57,10 +56,10 @@ enum AssetAttribute {
func extract<T>(from tokenValueHex: String) -> T? where T: AssetAttributeValue {
switch self {
case .mapping(let _, let syntax, _):
case .mapping(_, let syntax, _):
guard let value = parseValueFromMapping(tokenValueHex: tokenValueHex) else { return nil }
return syntax.extract(from: value, isMapping: true) as? T
case .direct(let _, let syntax):
case .direct(_, let syntax):
let value = parseValue(tokenValueHex: tokenValueHex)
return syntax.extract(from: value, isMapping: false) as? T
}

@ -63,14 +63,12 @@ class AssetDefinitionDiskBackingStore: AssetDefinitionBackingStore {
guard let lastModified = try? path.resourceValues(forKeys: [.contentModificationDateKey]) else {
return nil
}
return lastModified.contentModificationDate as? Date
return lastModified.contentModificationDate
}
func forEachContractWithXML(_ body: (String) -> Void) {
if let files = try? FileManager.default.contentsOfDirectory(at: directory, includingPropertiesForKeys: nil) {
let contracts = files.flatMap {
contract(fromPath: $0)
}
let contracts = files.compactMap { contract(fromPath: $0) }
for each in contracts {
body(each)
}
@ -93,7 +91,7 @@ class AssetDefinitionDiskBackingStore: AssetDefinitionBackingStore {
}
}
}
} catch let error {
} catch {
}
}
}

@ -13,7 +13,7 @@ class AssetDefinitionDiskBackingStoreWithOverrides: AssetDefinitionBackingStore
} else {
let store = AssetDefinitionDiskBackingStore(directoryName: "assetDefinitionsOverrides")
self.overridesStore = store
store.watchDirectoryContents() { contract in
store.watchDirectoryContents { contract in
self.delegate?.invalidateAssetDefinition(forContract: contract)
}
}

@ -76,7 +76,7 @@ class AssetDefinitionStore {
url,
method: .get,
headers: httpHeadersWithLastModifiedTimestamp(forContract: contract)
).response() { response in
).response { response in
if response.response?.statusCode == 304 {
completionHandler?(.unmodified)
} else if response.response?.statusCode == 406 {

@ -181,7 +181,7 @@ public extension DirectoryContentsWatcher {
if let paths = try? FileManager.default.contentsOfDirectory(at: url, includingPropertiesForKeys: [.contentModificationDateKey]) {
for each in paths {
if let lastModified = try? each.resourceValues(forKeys: [.contentModificationDateKey]).contentModificationDate as? Date {
if let lastModified = try? each.resourceValues(forKeys: [.contentModificationDateKey]).contentModificationDate {
contents[each.lastPathComponent] = lastModified
}
}
@ -216,10 +216,8 @@ public extension DirectoryContentsWatcher {
/// We don't check if date value is newer or older, because someone might drop an older file inside and it should be picked up
private func keysWithDifferentValues(between dictionary1: [String: Date], and dictionary2: [String: Date]) -> [String] {
var results = [String]()
for (k, v) in dictionary1 {
if v != dictionary2[k] {
results.append(k)
}
for (k, v) in dictionary1 where v != dictionary2[k] {
results.append(k)
}
let missingKeys = Array(dictionary2.keys) - Array(dictionary1.keys)
results.append(contentsOf: missingKeys)

@ -58,6 +58,6 @@ struct GeneralisedTime {
}
}
func <(lhs: GeneralisedTime, rhs: GeneralisedTime) -> Bool {
func < (lhs: GeneralisedTime, rhs: GeneralisedTime) -> Bool {
return lhs.date < rhs.date
}

@ -257,7 +257,7 @@ open class EtherKeystore: Keystore {
}
func delete(wallet: Wallet) -> Result<Void, KeystoreError> {
@discardableResult func delete(wallet: Wallet) -> Result<Void, KeystoreError> {
switch wallet.type {
case .real(let account):
guard let account = getAccount(for: account.address) else {

@ -20,7 +20,7 @@ protocol Keystore {
func export(account: Account, password: String, newPassword: String) -> Result<String, KeystoreError>
func export(account: Account, password: String, newPassword: String, completion: @escaping (Result<String, KeystoreError>) -> Void)
func exportData(account: Account, password: String, newPassword: String) -> Result<Data, KeystoreError>
func delete(wallet: Wallet) -> Result<Void, KeystoreError>
@discardableResult func delete(wallet: Wallet) -> Result<Void, KeystoreError>
func delete(wallet: Wallet, completion: @escaping (Result<Void, KeystoreError>) -> Void)
func updateAccount(account: Account, password: String, newPassword: String) -> Result<Void, KeystoreError>
func signPersonalMessage(_ data: Data, for account: Account) -> Result<Data, KeystoreError>

@ -249,7 +249,6 @@ class UniversalLinkCoordinator: Coordinator {
case .updated:
strongSelf.makeTicketHolderImpl(bytes32Tickets: bytes32Tickets, contractAddress: contractAddress)
strongSelf.updateTicketFields()
break
case .unmodified, .error:
break
}
@ -404,7 +403,7 @@ extension UniversalLinkCoordinator: ImportTicketViewControllerDelegate {
}
func didPressImport(in viewController: ImportTicketViewController) {
if let signedOrder = viewController.signedOrder, let tokenObj = viewController.tokenObject {
if let signedOrder = viewController.signedOrder {
self.delegate?.didImported(contract: signedOrder.order.contractAddress, in: self)
}

@ -3,7 +3,7 @@
import UIKit
struct TicketRowViewModel {
var ticketHolder: TokenHolder? = nil
var ticketHolder: TokenHolder?
var backgroundColor: UIColor {
return Colors.appWhite

@ -17,7 +17,7 @@ class TicketRowView: UIView {
let cityLabel = UILabel()
let timeLabel = UILabel()
let teamsLabel = UILabel()
var detailsRowStack: UIStackView? = nil
var detailsRowStack: UIStackView?
let showCheckbox: Bool
var areDetailsVisible = false {
didSet {

@ -31,7 +31,7 @@ class HelpUsCoordinator: Coordinator {
func rateUs() {
if #available(iOS 10.3, *) { SKStoreReviewController.requestReview() } else {
UIApplication.shared.openURL(URL(string: Constants.appstoreURL)!)
UIApplication.shared.open(URL(string: Constants.appstoreURL)!, options: [:])
}
appTracker.completedRating = true
}

@ -142,7 +142,7 @@ struct Config {
func createDefaultTicketToken() -> ERCToken? {
guard let contract = ticketContractAddress else { return nil }
guard let contractAddress = Address(string: contract) else { return nil}
guard let contractAddress = Address(string: contract) else { return nil }
let xmlHandler = XMLHandler(contract: contract)
let lang = xmlHandler.getLang()
let name = xmlHandler.getName(lang: lang)

@ -22,23 +22,21 @@ class GetContractInteractions {
let etherscanURL = RPCServer(chainID: chainId).etherscanAPIURLForTransactionList(for: address)
Alamofire.request(etherscanURL).validate().responseJSON { response in
switch response.result {
case .success(let value):
let json = JSON(value)
let contracts: [String] = json["result"].map { _, transactionJson in
if transactionJson["input"] != "0x" {
//every transaction that has input is by default a transaction to a contract
return transactionJson["to"].description
}
return ""
case .success(let value):
let json = JSON(value)
let contracts: [String] = json["result"].map { _, transactionJson in
if transactionJson["input"] != "0x" {
//every transaction that has input is by default a transaction to a contract
return transactionJson["to"].description
}
let nonEmptyContracts = contracts.filter { !$0.isEmpty }
let uniqueNonEmptyContracts = Array(Set(nonEmptyContracts))
completion(uniqueNonEmptyContracts)
case .failure(let error):
print(error)
completion([])
default:
completion([])
return ""
}
let nonEmptyContracts = contracts.filter { !$0.isEmpty }
let uniqueNonEmptyContracts = Array(Set(nonEmptyContracts))
completion(uniqueNonEmptyContracts)
case .failure(let error):
print(error)
completion([])
}
}
}

@ -73,7 +73,7 @@ class TokensCoordinator: Coordinator {
}
private func refreshUponAssetDefinitionChanges() {
assetDefinitionStore.subscribe { [weak self] contract in
assetDefinitionStore.subscribe { [weak self] _ in
self?.storage.updateERC875TokensToLocalizedName()
}
}
@ -143,7 +143,7 @@ class TokensCoordinator: Coordinator {
self.storage.add(tokens: [token])
completion()
case .failed(let networkReachable):
if let networkReachable = networkReachable, networkReachable {
if let networkReachable = networkReachable, networkReachable {
self.storage.add(deadContracts: [DeletedContract(contract: contract)])
}
completion()
@ -262,7 +262,6 @@ class TokensCoordinator: Coordinator {
callCompletionFailed()
}
}
break
case .erc721:
self.storage.getERC721Balance(for: address) { result in
switch result {
@ -274,7 +273,6 @@ class TokensCoordinator: Coordinator {
callCompletionFailed()
}
}
break
case .erc20:
self.storage.getDecimals(for: address) { result in
switch result {
@ -286,7 +284,6 @@ class TokensCoordinator: Coordinator {
callCompletionFailed()
}
}
break
case .ether:
break
}
@ -339,10 +336,8 @@ extension TokensCoordinator: NewTokenViewControllerDelegate {
viewController.updateDecimalsValue(decimals)
case .nonFungibleTokenComplete(_, _, _, let tokenType):
viewController.updateFormForTokenType(tokenType)
break
case .fungibleTokenComplete:
viewController.updateFormForTokenType(.erc20)
break
case .failed:
break
}

@ -13,7 +13,7 @@ class TokenObject: Object {
@objc dynamic var value: String = ""
@objc dynamic var isDisabled: Bool = false
var balance = List<TokenBalance>()
var nonZeroBalance: Array<TokenBalance> {
var nonZeroBalance: [TokenBalance] {
return Array(balance.filter { isNonZeroBalance($0.balance) })
}
@objc dynamic var rawType: String = TokenType.erc20.rawValue

@ -217,14 +217,11 @@ class TokensDataStore {
} else {
completion(.erc20)
}
break
case .failure:
completion(.erc20)
break
}
}
}
break
case .failure:
self.getIsERC721ContractCoordinator.getIsERC721Contract(for: address!) { result in
switch result {
@ -234,13 +231,10 @@ class TokensDataStore {
} else {
completion(.erc20)
}
break
case .failure:
completion(.erc20)
break
}
}
break
}
}
}

@ -221,16 +221,16 @@ class NewTokenViewController: UIViewController {
return false
}
switch tokenType {
case .ether, .erc20:
guard !decimalsTextField.value.trimmed.isEmpty else {
displayError(title: R.string.localizable.decimals(), error: ValidationError(msg: R.string.localizable.warningFieldRequired()))
return false
}
case .erc721, .erc875:
guard !balanceTextField.value.trimmed.isEmpty else {
displayError(title: R.string.localizable.balance(), error: ValidationError(msg: R.string.localizable.warningFieldRequired()))
return false
}
case .ether, .erc20:
guard !decimalsTextField.value.trimmed.isEmpty else {
displayError(title: R.string.localizable.decimals(), error: ValidationError(msg: R.string.localizable.warningFieldRequired()))
return false
}
case .erc721, .erc875:
guard !balanceTextField.value.trimmed.isEmpty else {
displayError(title: R.string.localizable.balance(), error: ValidationError(msg: R.string.localizable.warningFieldRequired()))
return false
}
}
return true

@ -164,25 +164,22 @@ class TransactionConfigurator {
case .ERC721Token:
session.web3.request(request: ContractERC721Transfer(address: transaction.to!.description,
tokenId: transaction.tokenId!))
{ [unowned self] result in
switch result {
case .success(let res):
let data = Data(hex: res.drop0x)
self.configuration = TransactionConfiguration(
gasPrice: self.calculatedGasPrice,
gasLimit: Constants.gasLimit,
data: data
)
completion(.success(()))
case .failure(let error):
completion(.failure(error))
}
tokenId: transaction.tokenId!)) { [unowned self] result in
switch result {
case .success(let res):
let data = Data(hex: res.drop0x)
self.configuration = TransactionConfiguration(
gasPrice: self.calculatedGasPrice,
gasLimit: Constants.gasLimit,
data: data
)
completion(.success(()))
case .failure(let error):
completion(.failure(error))
}
}
}
}
func previewTransaction() -> PreviewTransaction {
return PreviewTransaction(

@ -91,7 +91,7 @@ class TransferTicketsCoordinator: Coordinator {
switch result {
case .success:
self.sendTransaction(with: configurator)
case .failure(let error):
case .failure:
//TODO use the error object or remove it from the case-statement
self.processFailed()
}
@ -110,7 +110,7 @@ class TransferTicketsCoordinator: Coordinator {
switch result {
case .success:
celf.processSuccessful()
case .failure(let error):
case .failure:
//TODO use the error object or remove it from the case-statement
celf.processFailed()
}

@ -103,7 +103,6 @@ class TransferTicketsQuantitySelectionViewController: UIViewController, TicketVe
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
super.init(coder: aDecoder)
}
@objc

@ -4,9 +4,9 @@ import UIKit
struct SendHeaderViewViewModel {
var title = ""
var ticker: CoinTicker? = nil
var currencyAmount: String? = nil
var currencyAmountWithoutSymbol: Double? = nil
var ticker: CoinTicker?
var currencyAmount: String?
var currencyAmountWithoutSymbol: Double?
var showAlternativeAmount = false
var issuer: String {

@ -30,7 +30,7 @@ class WalletCoordinator: Coordinator {
}
///Return true if caller should proceed to show UI (`navigationController`)
func start(_ entryPoint: WalletEntryPoint) -> Bool {
@discardableResult func start(_ entryPoint: WalletEntryPoint) -> Bool {
self.entryPoint = entryPoint
switch entryPoint {
case .welcome:

@ -23,13 +23,10 @@ class AssetDefinitionStoreTests: XCTestCase {
let expectation = XCTestExpectation(description: "cached case should not be called")
expectation.isInverted = true
store.fetchXML(forContract: contractAddress, useCacheAndFetch: true) { [weak self] result in
guard let strongSelf = self else {
return
}
guard self != nil else { return }
switch result {
case .cached:
expectation.fulfill()
break
case .updated, .unmodified, .error:
break
}
@ -43,13 +40,10 @@ class AssetDefinitionStoreTests: XCTestCase {
store[contractAddress] = "something"
let expectation = XCTestExpectation(description: "cached case should be called")
store.fetchXML(forContract: contractAddress, useCacheAndFetch: true) { [weak self] result in
guard let strongSelf = self else {
return
}
guard self != nil else { return }
switch result {
case .cached:
expectation.fulfill()
break
case .updated, .unmodified, .error:
break
}

@ -8,7 +8,7 @@ import XCTest
import BigInt
import TrustKeystore
class ClaimOrderCoordinatorTests : XCTestCase {
class ClaimOrderCoordinatorTests: XCTestCase {
var expectations = [XCTestExpectation]()
@ -76,7 +76,6 @@ class ClaimOrderCoordinatorTests : XCTestCase {
gasLimit: unsignedTransaction.gasLimit,
chainID: 3)
let sendTransactionCoordinator = SendTransactionCoordinator(session: session,
keystore: keystore,
confirmType: .signThenSend)

@ -3,7 +3,6 @@
import XCTest
@testable import Trust
class SplashCoordinatorTests: XCTestCase {
func testStart() {
let window = UIWindow()

@ -276,7 +276,7 @@ class EtherKeystoreTests: XCTestCase {
func testAddWatchAddress() {
let keystore = FakeEtherKeystore()
let address: Address = .make()
keystore.importWallet(type: ImportType.watch(address: address)) {_ in }
keystore.importWallet(type: ImportType.watch(address: address)) { _ in }
XCTAssertEqual(1, keystore.wallets.count)
XCTAssertEqual(address, keystore.wallets[0].address)

@ -52,7 +52,7 @@ class RLPTests: XCTestCase {
XCTAssertEqual(RLP.encode(["cat", "dog"])!.hex(), "c88363617483646f67")
XCTAssertEqual(RLP.encode([ [], [[]], [ [], [[]] ] ])!.hex(), "c7c0c1c0c3c0c1c0")
XCTAssertEqual(RLP.encode([1, 0xffffff, [4, 5, 5], "abc"])!.hex(), "cd0183ffffffc304050583616263")
let encoded = RLP.encode(Array<Int>(repeating: 0, count: 1024))!
let encoded = RLP.encode([Int](repeating: 0, count: 1024))!
print(encoded.hex())
XCTAssert(encoded.hex().hasPrefix("f90400"))
}

@ -15,6 +15,3 @@ extension Account {
)
}
}

@ -8,7 +8,7 @@ import Result
struct FakeKeystore: Keystore {
static var current: Wallet?
var hasWallets: Bool {
return wallets.count > 0
return !wallets.isEmpty
}
var keystoreDirectory: URL {
return URL(fileURLWithPath: "file://")
@ -64,7 +64,7 @@ struct FakeKeystore: Keystore {
return .failure(KeystoreError.failedToSignTransaction)
}
func delete(wallet wallet: Wallet) -> Result<Void, KeystoreError> {
func delete(wallet: Wallet) -> Result<Void, KeystoreError> {
//TODO: Implement
return .failure(KeystoreError.failedToSignTransaction)
}
@ -96,7 +96,7 @@ struct FakeKeystore: Keystore {
return .none
}
func convertPrivateKeyToKeystoreFile(privateKey: String, passphrase: String) -> Result<[String : Any], KeystoreError> {
func convertPrivateKeyToKeystoreFile(privateKey: String, passphrase: String) -> Result<[String: Any], KeystoreError> {
//TODO: Implement
return .failure(KeystoreError.failedToSignTransaction)
}

@ -7,6 +7,8 @@ import XCTest
class EtherNumberFormatterTests: XCTestCase {
let fullFormatter = EtherNumberFormatter(locale: Locale(identifier: "en_US_POSIX"))
let shortFormatter: EtherNumberFormatter = {
var formatter = EtherNumberFormatter(locale: Locale(identifier: "en_US_POSIX"))

@ -4,7 +4,7 @@ import XCTest
import TrustKeystore
import BigInt
class MarketQueueHandlerTests: XCTestCase {
class MarketQueueHandlerTests: XCTestCase {
var expectations = [XCTestExpectation]()
let keyStore = FakeEtherKeystore()
@ -12,8 +12,7 @@ class MarketQueueHandlerTests: XCTestCase {
func testGetOrders() {
let expectation = self.expectation(description: "wait til callback")
expectations.append(expectation)
MarketQueueHandler().getOrders(callback: {
callback in
MarketQueueHandler().getOrders(callback: { callback in
print(callback)
expectation.fulfill()
})

@ -4,14 +4,14 @@ import TrustKeystore
import RealmSwift
import BigInt
class OrderSigningTests : XCTestCase {
class OrderSigningTests: XCTestCase {
func testSigningOrders() {
let keystore = try! EtherKeystore()
let contractAddress = "0xacDe9017473D7dC82ACFd0da601E4de291a7d6b0"
keystore.createAccount(with: "test") { result in
let account = try! result.dematerialize()
var testOrdersList : Array<Order> = Array<Order>()
var testOrdersList = [Order]()
//set up test orders
var indices = [UInt16]()
indices.append(14)
@ -27,15 +27,9 @@ class OrderSigningTests : XCTestCase {
testOrdersList.append(testOrder1)
}
let signOrders = OrderHandler()
do {
let signedOrders = try! signOrders.signOrders(orders: testOrdersList, account: account)
XCTAssertGreaterThanOrEqual(2016, signedOrders.count)
keystore.delete(wallet: Wallet(type: WalletType.real(account)))
}
catch {
keystore.delete(wallet: Wallet(type: WalletType.real(account)))
XCTFail()
}
let signedOrders = try! signOrders.signOrders(orders: testOrdersList, account: account)
XCTAssertGreaterThanOrEqual(2016, signedOrders.count)
keystore.delete(wallet: Wallet(type: WalletType.real(account)))
}
}

@ -6,7 +6,7 @@ import XCTest
class TransactionViewModelTests: XCTestCase {
func testErrorState() {
let viewModel = TransactionViewModel(transaction: .make(state: .error), config: .make(), chainState: .make(), currentWallet: .make())
let _ = TransactionViewModel(transaction: .make(state: .error), config: .make(), chainState: .make(), currentWallet: .make())
}

@ -4,7 +4,7 @@ import FBSnapshotTestCase
@testable import Trust
import UIKit
class TransferTicketsQuantitySelectionViewControllerTests: FBSnapshotTestCase {
class TransferTicketsQuantitySelectionViewControllerTests: FBSnapshotTestCase {
override func setUp() {
super.setUp()
isDeviceAgnostic = true

Loading…
Cancel
Save