Fix Test suite #4331

pull/4332/head
Krypto Pank 3 years ago
parent 50f6354123
commit ccf533dd87
  1. 11
      AlphaWallet/Transactions/Storage/TransactionsStorage.swift
  2. 2
      AlphaWalletTests/Coordinators/InCoordinatorTests.swift
  3. 2
      AlphaWalletTests/Settings/Coordinators/SettingsCoordinatorTests.swift
  4. 4
      AlphaWalletTests/Transactions/Storage/TransactionsStorageTests.swift

@ -283,6 +283,15 @@ class TransactionDataStore {
}
}
func deleteAllForTestsOnly() {
store.performSync { realm in
try? realm.safeWrite {
realm.delete(realm.objects(LocalizedOperationObject.self))
realm.delete(realm.objects(Transaction.self))
}
}
}
func writeJsonForTransactions(toUrl url: URL, server: RPCServer) {
do {
let data = try functional.generateJsonForTransactions(transactionStorage: self, server: server, toUrl: url)
@ -291,7 +300,7 @@ class TransactionDataStore {
} catch {
verboseLog("Error writing transactions for \(server) to JSON: \(url.absoluteString) error: \(error)")
}
}
}
}
extension TransactionDataStore: Erc721TokenIdsFetcher {

@ -124,7 +124,7 @@ class InCoordinatorTests: XCTestCase {
c1.start(animated: false)
XCTAssertEqual(c2.keystore.currentWallet, account1)
XCTAssertEqual(c2.keystore.currentWallet, account2)
}
func testShowSendFlow() {

@ -34,7 +34,7 @@ class SettingsCoordinatorTests: XCTestCase {
.sink { value in
deletedWallet = value
expectation.fulfill()
storage.deleteAll()
storage.deleteAllForTestsOnly()
}
walletAddressesStore.removeAddress(wallet)

@ -67,7 +67,7 @@ class TransactionsStorageTests: XCTestCase {
XCTAssertEqual(1, storage.count)
XCTAssertEqual(two, storage.transactions(forServer: .main).first)
XCTAssertEqual(two.primaryKey, storage.transactions(forServer: .main).first!.primaryKey)
}
func testDeleteAll() {
@ -80,7 +80,7 @@ class TransactionsStorageTests: XCTestCase {
XCTAssertEqual(2, storage.count)
storage.deleteAll()
storage.deleteAllForTestsOnly()
XCTAssertEqual(0, storage.count)
}

Loading…
Cancel
Save