Skip to content

Commit f48dbb0

Browse files
committed
test: fix storagePath ambiguity and CoreData aliases in stubs\n\n- Use fearlessStoragePath for SSFModels.ChainAsset in WalletLocalSubscriptionFactoryStub\n- Remove module qualification for CDAccountInfo/CDStashItem\n- Return DecodedEraIndex in StakingLocalSubscriptionFactoryStub.getCurrentEra
Signed-off-by: William Richter <[email protected]>
1 parent 908c4e3 commit f48dbb0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

fearlessTests/Mocks/DataProviders/StakingLocalSubscriptionFactoryStub.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ final class StakingLocalSubscriptionFactoryStub: RelaychainStakingLocalSubscript
171171
)
172172

173173
if let currentEra = currentEra {
174-
return DecodedU32(identifier: localKey, item: StringScaleMapper(value: currentEra))
174+
return DecodedEraIndex(identifier: localKey, item: StringScaleMapper(value: currentEra))
175175
} else {
176-
return DecodedU32(identifier: localKey, item: nil)
176+
return DecodedEraIndex(identifier: localKey, item: nil)
177177
}
178178
}()
179179

@@ -195,7 +195,7 @@ final class StakingLocalSubscriptionFactoryStub: RelaychainStakingLocalSubscript
195195
).createStashItemProvider(for: address)
196196

197197
if let stashItem = stashItem {
198-
let repository: CoreDataRepository<StashItem, fearless.CDStashItem> = storageFacade.createRepository()
198+
let repository: CoreDataRepository<StashItem, CDStashItem> = storageFacade.createRepository()
199199
let saveOperation = repository.saveOperation({ [stashItem] }, { [] })
200200
OperationQueue().addOperations([saveOperation], waitUntilFinished: true)
201201
}

fearlessTests/Mocks/DataProviders/WalletLocalSubscriptionFactoryStub.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class WalletLocalSubscriptionFactoryStub: WalletLocalSubscriptionFactoryPr
1717
for accountId: AccountId,
1818
chainAsset: ChainAsset
1919
) throws -> StreamableProvider<AccountInfoStorageWrapper> {
20-
let codingPath = chainAsset.storagePath
20+
let codingPath = chainAsset.fearlessStoragePath
2121

2222
let localKey = try LocalStorageKeyFactory().createFromStoragePath(
2323
codingPath,
@@ -35,17 +35,17 @@ final class WalletLocalSubscriptionFactoryStub: WalletLocalSubscriptionFactoryPr
3535
private func getProvider(for key: String) -> StreamableProvider<AccountInfoStorageWrapper> {
3636
let facade = SubstrateDataStorageFacade.shared
3737

38-
let mapper: CodableCoreDataMapper<AccountInfoStorageWrapper, fearless.CDAccountInfo> =
39-
CodableCoreDataMapper(entityIdentifierFieldName: #keyPath(fearless.CDAccountInfo.identifier))
38+
let mapper: CodableCoreDataMapper<AccountInfoStorageWrapper, CDAccountInfo> =
39+
CodableCoreDataMapper(entityIdentifierFieldName: #keyPath(CDAccountInfo.identifier))
4040

4141
let filter = NSPredicate.filterStorageItemsBy(identifier: key)
42-
let storage: CoreDataRepository<AccountInfoStorageWrapper, fearless.CDAccountInfo> =
42+
let storage: CoreDataRepository<AccountInfoStorageWrapper, CDAccountInfo> =
4343
facade.createRepository(filter: filter)
4444
let source = EmptyStreamableSource<AccountInfoStorageWrapper>()
4545
let observable = CoreDataContextObservable(
4646
service: facade.databaseService,
4747
mapper: AnyCoreDataMapper(mapper),
48-
predicate: { ($0 as? fearless.CDAccountInfo)?.identifier == key },
48+
predicate: { ($0 as? CDAccountInfo)?.identifier == key },
4949
processingQueue: processingQueue
5050
)
5151

0 commit comments

Comments
 (0)