Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test repair #1285

Open
wants to merge 37 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b4c4410
old test targets has been removed from fearless
DRadmir Sep 4, 2024
929bb0c
new test target has been implemented
DRadmir Sep 5, 2024
1f7c168
test fix
DRadmir Sep 5, 2024
023b08b
build fix
DRadmir Sep 6, 2024
0de4cca
path fix
DRadmir Sep 6, 2024
5fa7087
script has been fixed
DRadmir Sep 6, 2024
090948f
scripts queue reordered
DRadmir Sep 6, 2024
07924bc
test
DRadmir Sep 6, 2024
154687f
Sourcery scripts has been fixed
DRadmir Sep 6, 2024
1c9a7e8
Merge branch 'test-repair' of github.com:soramitsu/fearless-iOS into …
DRadmir Sep 6, 2024
a6b5f33
source path has been fixed
DRadmir Sep 6, 2024
7b17583
use config directory
DRadmir Sep 6, 2024
8d4250c
use config directory
DRadmir Sep 6, 2024
61c62d1
Merge branch 'test-repair' of github.com:soramitsu/fearless-iOS into …
DRadmir Sep 6, 2024
899b696
source path fix
DRadmir Sep 6, 2024
7851123
The configurations were combined
DRadmir Sep 6, 2024
01f29c6
fix yml
DRadmir Sep 6, 2024
8d14983
scripts fixes
DRadmir Sep 6, 2024
c6ac0cb
fix for output file
DRadmir Sep 6, 2024
7e7850f
CIKeys path
DRadmir Sep 6, 2024
93396bc
new place for generated file
DRadmir Sep 6, 2024
1079e8b
out path fix
DRadmir Sep 6, 2024
12bf304
fix
DRadmir Sep 6, 2024
ea694fe
fix
DRadmir Sep 6, 2024
1710957
fix
DRadmir Sep 6, 2024
6886056
Fix var
C4tWithShell Sep 6, 2024
dec185b
Fix var
C4tWithShell Sep 6, 2024
0c51fa8
Fix var
C4tWithShell Sep 6, 2024
cbd0d84
Fix var
C4tWithShell Sep 6, 2024
90a599e
Test relative path
C4tWithShell Sep 6, 2024
25815b2
Test vars
C4tWithShell Sep 9, 2024
490bb5b
Test
C4tWithShell Sep 9, 2024
cf4404d
Fix vars
C4tWithShell Sep 9, 2024
b1eca73
Test vars
C4tWithShell Sep 9, 2024
1790822
Clean
C4tWithShell Sep 9, 2024
b508764
Add output
C4tWithShell Sep 9, 2024
254673f
Adjust vars
C4tWithShell Sep 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ iOSInjectionProject/
#
# Custom scripts
fearless/env-vars.sh
*.generated.swift
Tests/Mocks/CommonMocks.swift
Tests/Mocks/ModuleMocks.swift
CIKeys.generated.swift
R.generated.swift
#
# Generamba
Templates/
Expand Down
71 changes: 71 additions & 0 deletions FearlessTestCaravan/ChainModelsEquatableTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import XCTest
import SSFChainRegistry
import SSFNetwork
import RobinHood
import SoraFoundation
@testable import fearless

final class ChainSyncServiceTests: XCTestCase, EventVisitorProtocol {

private var service: fearless.ChainSyncService?
private let eventCenter = EventCenter.shared

private var rootInteractorExpectation: XCTestExpectation?
private var testExpectation: XCTestExpectation?
private var newOrUpdatedChainsCount: Int?
private var removedChainsCount: Int?

override func setUpWithError() throws {
let repositoryFacade = SubstrateDataStorageFacade.shared
let chainRepositoryFactory = ChainRepositoryFactory(storageFacade: repositoryFacade)
let chainRepository = chainRepositoryFactory.createRepository()

let syncService = SSFChainRegistry.ChainSyncService(
chainsUrl: ApplicationConfig.shared.chainsSourceUrl,
operationQueue: OperationQueue(),
dataFetchFactory: NetworkOperationFactory()
)

let chainSyncService = ChainSyncService(
syncService: syncService,
repository: AnyDataProviderRepository(chainRepository),
eventCenter: EventCenter.shared,
operationQueue: OperationManagerFacade.syncQueue,
logger: Logger.shared,
applicationHandler: ApplicationHandler()
)
fearless.ChainSyncService.fetchLocalData = true
service = chainSyncService

eventCenter.add(observer: self, dispatchIn: nil)
}

override func tearDownWithError() throws {
service = nil
newOrUpdatedChainsCount = nil
removedChainsCount = nil
}

func testEquatable() throws {
rootInteractorExpectation = XCTestExpectation()
wait(for: [rootInteractorExpectation].compactMap { $0 }, timeout: 1)
service?.syncUp()
testExpectation = XCTestExpectation()
wait(for: [testExpectation].compactMap { $0 }, timeout: 1)
XCTAssertEqual(newOrUpdatedChainsCount, 0)
XCTAssertEqual(removedChainsCount, 0)
}

// MARK: - EventVisitorProtocol

func processChainSyncDidComplete(event: ChainSyncDidComplete) {
if let rootInteractorExpectation {
rootInteractorExpectation.fulfill()
}
if let testExpectation {
testExpectation.fulfill()
newOrUpdatedChainsCount = event.newOrUpdatedChains.count
removedChainsCount = event.removedChains.count
}
}
}
210 changes: 210 additions & 0 deletions FearlessTestCaravan/Mocks/BalanceLocksFetching.generated.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
// Generated using Sourcery 2.2.5 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT
// swiftlint:disable all

import UIKit
import SSFModels
@testable import fearless

public class BalanceLocksFetchingMock: BalanceLocksFetching {
public init() {}

//MARK: - fetchStakingLocks

public var fetchStakingLocksForThrowableError: Error?
public var fetchStakingLocksForCallsCount = 0
public var fetchStakingLocksForCalled: Bool {
return fetchStakingLocksForCallsCount > 0
}
public var fetchStakingLocksForReceivedAccountId: AccountId?
public var fetchStakingLocksForReceivedInvocations: [AccountId] = []
public var fetchStakingLocksForReturnValue: StakingLocks!
public var fetchStakingLocksForClosure: ((AccountId) throws -> StakingLocks)?

public func fetchStakingLocks(for accountId: AccountId) throws -> StakingLocks {
if let error = fetchStakingLocksForThrowableError {
throw error
}
fetchStakingLocksForCallsCount += 1
fetchStakingLocksForReceivedAccountId = accountId
fetchStakingLocksForReceivedInvocations.append(accountId)
return try fetchStakingLocksForClosure.map({ try $0(accountId) }) ?? fetchStakingLocksForReturnValue
}

//MARK: - fetchNominationPoolLocks

public var fetchNominationPoolLocksForThrowableError: Error?
public var fetchNominationPoolLocksForCallsCount = 0
public var fetchNominationPoolLocksForCalled: Bool {
return fetchNominationPoolLocksForCallsCount > 0
}
public var fetchNominationPoolLocksForReceivedAccountId: AccountId?
public var fetchNominationPoolLocksForReceivedInvocations: [AccountId] = []
public var fetchNominationPoolLocksForReturnValue: StakingLocks!
public var fetchNominationPoolLocksForClosure: ((AccountId) throws -> StakingLocks)?

public func fetchNominationPoolLocks(for accountId: AccountId) throws -> StakingLocks {
if let error = fetchNominationPoolLocksForThrowableError {
throw error
}
fetchNominationPoolLocksForCallsCount += 1
fetchNominationPoolLocksForReceivedAccountId = accountId
fetchNominationPoolLocksForReceivedInvocations.append(accountId)
return try fetchNominationPoolLocksForClosure.map({ try $0(accountId) }) ?? fetchNominationPoolLocksForReturnValue
}

//MARK: - fetchGovernanceLocks

public var fetchGovernanceLocksForThrowableError: Error?
public var fetchGovernanceLocksForCallsCount = 0
public var fetchGovernanceLocksForCalled: Bool {
return fetchGovernanceLocksForCallsCount > 0
}
public var fetchGovernanceLocksForReceivedAccountId: AccountId?
public var fetchGovernanceLocksForReceivedInvocations: [AccountId] = []
public var fetchGovernanceLocksForReturnValue: Decimal!
public var fetchGovernanceLocksForClosure: ((AccountId) throws -> Decimal)?

public func fetchGovernanceLocks(for accountId: AccountId) throws -> Decimal {
if let error = fetchGovernanceLocksForThrowableError {
throw error
}
fetchGovernanceLocksForCallsCount += 1
fetchGovernanceLocksForReceivedAccountId = accountId
fetchGovernanceLocksForReceivedInvocations.append(accountId)
return try fetchGovernanceLocksForClosure.map({ try $0(accountId) }) ?? fetchGovernanceLocksForReturnValue
}

//MARK: - fetchCrowdloanLocks

public var fetchCrowdloanLocksForThrowableError: Error?
public var fetchCrowdloanLocksForCallsCount = 0
public var fetchCrowdloanLocksForCalled: Bool {
return fetchCrowdloanLocksForCallsCount > 0
}
public var fetchCrowdloanLocksForReceivedAccountId: AccountId?
public var fetchCrowdloanLocksForReceivedInvocations: [AccountId] = []
public var fetchCrowdloanLocksForReturnValue: Decimal!
public var fetchCrowdloanLocksForClosure: ((AccountId) throws -> Decimal)?

public func fetchCrowdloanLocks(for accountId: AccountId) throws -> Decimal {
if let error = fetchCrowdloanLocksForThrowableError {
throw error
}
fetchCrowdloanLocksForCallsCount += 1
fetchCrowdloanLocksForReceivedAccountId = accountId
fetchCrowdloanLocksForReceivedInvocations.append(accountId)
return try fetchCrowdloanLocksForClosure.map({ try $0(accountId) }) ?? fetchCrowdloanLocksForReturnValue
}

//MARK: - fetchVestingLocks

public var fetchVestingLocksForCurrencyIdThrowableError: Error?
public var fetchVestingLocksForCurrencyIdCallsCount = 0
public var fetchVestingLocksForCurrencyIdCalled: Bool {
return fetchVestingLocksForCurrencyIdCallsCount > 0
}
public var fetchVestingLocksForCurrencyIdReceivedArguments: (accountId: AccountId, currencyId: CurrencyId?)?
public var fetchVestingLocksForCurrencyIdReceivedInvocations: [(accountId: AccountId, currencyId: CurrencyId?)] = []
public var fetchVestingLocksForCurrencyIdReturnValue: Decimal!
public var fetchVestingLocksForCurrencyIdClosure: ((AccountId, CurrencyId?) throws -> Decimal)?

public func fetchVestingLocks(for accountId: AccountId, currencyId: CurrencyId?) throws -> Decimal {
if let error = fetchVestingLocksForCurrencyIdThrowableError {
throw error
}
fetchVestingLocksForCurrencyIdCallsCount += 1
fetchVestingLocksForCurrencyIdReceivedArguments = (accountId: accountId, currencyId: currencyId)
fetchVestingLocksForCurrencyIdReceivedInvocations.append((accountId: accountId, currencyId: currencyId))
return try fetchVestingLocksForCurrencyIdClosure.map({ try $0(accountId, currencyId) }) ?? fetchVestingLocksForCurrencyIdReturnValue
}

//MARK: - fetchTotalLocks

public var fetchTotalLocksForCurrencyIdThrowableError: Error?
public var fetchTotalLocksForCurrencyIdCallsCount = 0
public var fetchTotalLocksForCurrencyIdCalled: Bool {
return fetchTotalLocksForCurrencyIdCallsCount > 0
}
public var fetchTotalLocksForCurrencyIdReceivedArguments: (accountId: AccountId, currencyId: CurrencyId?)?
public var fetchTotalLocksForCurrencyIdReceivedInvocations: [(accountId: AccountId, currencyId: CurrencyId?)] = []
public var fetchTotalLocksForCurrencyIdReturnValue: Decimal!
public var fetchTotalLocksForCurrencyIdClosure: ((AccountId, CurrencyId?) throws -> Decimal)?

public func fetchTotalLocks(for accountId: AccountId, currencyId: CurrencyId?) throws -> Decimal {
if let error = fetchTotalLocksForCurrencyIdThrowableError {
throw error
}
fetchTotalLocksForCurrencyIdCallsCount += 1
fetchTotalLocksForCurrencyIdReceivedArguments = (accountId: accountId, currencyId: currencyId)
fetchTotalLocksForCurrencyIdReceivedInvocations.append((accountId: accountId, currencyId: currencyId))
return try fetchTotalLocksForCurrencyIdClosure.map({ try $0(accountId, currencyId) }) ?? fetchTotalLocksForCurrencyIdReturnValue
}

//MARK: - fetchAssetLocks

public var fetchAssetLocksForCurrencyIdThrowableError: Error?
public var fetchAssetLocksForCurrencyIdCallsCount = 0
public var fetchAssetLocksForCurrencyIdCalled: Bool {
return fetchAssetLocksForCurrencyIdCallsCount > 0
}
public var fetchAssetLocksForCurrencyIdReceivedArguments: (accountId: AccountId, currencyId: CurrencyId?)?
public var fetchAssetLocksForCurrencyIdReceivedInvocations: [(accountId: AccountId, currencyId: CurrencyId?)] = []
public var fetchAssetLocksForCurrencyIdReturnValue: Decimal!
public var fetchAssetLocksForCurrencyIdClosure: ((AccountId, CurrencyId?) throws -> Decimal)?

public func fetchAssetLocks(for accountId: AccountId, currencyId: CurrencyId?) throws -> Decimal {
if let error = fetchAssetLocksForCurrencyIdThrowableError {
throw error
}
fetchAssetLocksForCurrencyIdCallsCount += 1
fetchAssetLocksForCurrencyIdReceivedArguments = (accountId: accountId, currencyId: currencyId)
fetchAssetLocksForCurrencyIdReceivedInvocations.append((accountId: accountId, currencyId: currencyId))
return try fetchAssetLocksForCurrencyIdClosure.map({ try $0(accountId, currencyId) }) ?? fetchAssetLocksForCurrencyIdReturnValue
}

//MARK: - fetchAssetFrozen

public var fetchAssetFrozenForCurrencyIdThrowableError: Error?
public var fetchAssetFrozenForCurrencyIdCallsCount = 0
public var fetchAssetFrozenForCurrencyIdCalled: Bool {
return fetchAssetFrozenForCurrencyIdCallsCount > 0
}
public var fetchAssetFrozenForCurrencyIdReceivedArguments: (accountId: AccountId, currencyId: CurrencyId?)?
public var fetchAssetFrozenForCurrencyIdReceivedInvocations: [(accountId: AccountId, currencyId: CurrencyId?)] = []
public var fetchAssetFrozenForCurrencyIdReturnValue: Decimal!
public var fetchAssetFrozenForCurrencyIdClosure: ((AccountId, CurrencyId?) throws -> Decimal)?

public func fetchAssetFrozen(for accountId: AccountId, currencyId: CurrencyId?) throws -> Decimal {
if let error = fetchAssetFrozenForCurrencyIdThrowableError {
throw error
}
fetchAssetFrozenForCurrencyIdCallsCount += 1
fetchAssetFrozenForCurrencyIdReceivedArguments = (accountId: accountId, currencyId: currencyId)
fetchAssetFrozenForCurrencyIdReceivedInvocations.append((accountId: accountId, currencyId: currencyId))
return try fetchAssetFrozenForCurrencyIdClosure.map({ try $0(accountId, currencyId) }) ?? fetchAssetFrozenForCurrencyIdReturnValue
}

//MARK: - fetchAssetBlocked

public var fetchAssetBlockedForCurrencyIdThrowableError: Error?
public var fetchAssetBlockedForCurrencyIdCallsCount = 0
public var fetchAssetBlockedForCurrencyIdCalled: Bool {
return fetchAssetBlockedForCurrencyIdCallsCount > 0
}
public var fetchAssetBlockedForCurrencyIdReceivedArguments: (accountId: AccountId, currencyId: CurrencyId?)?
public var fetchAssetBlockedForCurrencyIdReceivedInvocations: [(accountId: AccountId, currencyId: CurrencyId?)] = []
public var fetchAssetBlockedForCurrencyIdReturnValue: Decimal!
public var fetchAssetBlockedForCurrencyIdClosure: ((AccountId, CurrencyId?) throws -> Decimal)?

public func fetchAssetBlocked(for accountId: AccountId, currencyId: CurrencyId?) throws -> Decimal {
if let error = fetchAssetBlockedForCurrencyIdThrowableError {
throw error
}
fetchAssetBlockedForCurrencyIdCallsCount += 1
fetchAssetBlockedForCurrencyIdReceivedArguments = (accountId: accountId, currencyId: currencyId)
fetchAssetBlockedForCurrencyIdReceivedInvocations.append((accountId: accountId, currencyId: currencyId))
return try fetchAssetBlockedForCurrencyIdClosure.map({ try $0(accountId, currencyId) }) ?? fetchAssetBlockedForCurrencyIdReturnValue
}

}
25 changes: 1 addition & 24 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,13 @@ abstract_target 'fearlessAll' do
pod 'ReachabilitySwift'
pod 'SnapKit', '~> 5.0.0'
pod 'SwiftFormat/CLI', '~> 0.47.13'
pod 'Sourcery', '~> 1.4'
pod 'Sourcery'
pod 'Kingfisher', '7.10.2' , :inhibit_warnings => true
pod 'SVGKit'
pod 'Charts', '~> 4.1.0'
pod 'MediaView', :git => 'https://github.com/bnsports/MediaView.git', :branch => 'dev'
pod 'FearlessKeys', '0.1.4'

target 'fearlessTests' do
inherit! :search_paths

pod 'Cuckoo'
pod 'SoraFoundation', '~> 1.0.0'
pod 'R.swift', '6.1.0', :inhibit_warnings => true
pod 'FireMock', :inhibit_warnings => true
pod 'SoraKeystore', :git => 'https://github.com/soramitsu/keystore-iOS.git', :tag => '1.0.1'
pod 'Sourcery', '~> 1.4'

end

target 'fearlessIntegrationTests'

target 'fearless'

end
Expand All @@ -50,14 +36,5 @@ post_install do |installer|
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
end
if target.name == 'SSFXCM'
target.build_configurations.each do |config|
if config.name == 'Dev'
config.build_settings['OTHER_SWIFT_FLAGS'] = '-DF_DEV -D COCOAPODS'
else
config.build_settings['OTHER_SWIFT_FLAGS'] = '-D COCOAPODS'
end
end
end
end
end
Loading
Loading