Skip to content

Commit

Permalink
[#1252] NetworkTests fails to run
Browse files Browse the repository at this point in the history
- NetworkTests are buildable and can run not crashing due to lack of mocked properties
- most tests have been fixed and pass again
  • Loading branch information
LukasKorba committed Sep 11, 2023
1 parent 2da8dce commit f3f519b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
12 changes: 5 additions & 7 deletions Tests/NetworkTests/BlockStreamingTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,9 @@ class BlockStreamingTest: ZcashTestCase {

let action = DownloadAction(container: mockContainer, configProvider: CompactBlockProcessor.ConfigProvider(config: processorConfig))
let blockDownloader = mockContainer.resolve(BlockDownloader.self)
let syncControlData = SyncControlData(
latestBlockHeight: latestBlockHeight,
latestScannedHeight: startHeight,
firstUnenhancedHeight: nil
)

let context = ActionContextMock()
await context.update(syncControlData: syncControlData)
context.updateStateClosure = { _ in }

let expectation = XCTestExpectation()

Expand Down Expand Up @@ -175,7 +171,9 @@ class BlockStreamingTest: ZcashTestCase {
firstUnenhancedHeight: nil
)
let context = ActionContextMock()
await context.update(syncControlData: syncControlData)
context.updateStateClosure = { _ in }
context.underlyingSyncControlData = syncControlData
context.lastScannedHeight = startHeight

let date = Date()

Expand Down
11 changes: 3 additions & 8 deletions Tests/NetworkTests/CompactBlockReorgTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@ class CompactBlockReorgTests: ZcashTestCase {
mockValidateCombinedChainFailureError: .rustValidateCombinedChainInvalidChain(Int32(network.constants.saplingActivationHeight + 320))
)

let transactionRepository = MockTransactionRepository(
unminedCount: 0,
receivedCount: 0,
sentCount: 0,
scannedHeight: 0,
network: network
)

Dependencies.setup(
in: mockContainer,
urls: Initializer.URLs(
Expand All @@ -117,6 +109,9 @@ class CompactBlockReorgTests: ZcashTestCase {
loggingPolicy: .default(.debug)
)

await self.rustBackendMockHelper.rustBackendMock.setPutSaplingSubtreeRootsStartIndexRootsClosure { _, _ in }
await self.rustBackendMockHelper.rustBackendMock.setUpdateChainTipHeightClosure { _ in }

mockContainer.mock(type: LatestBlocksDataProvider.self, isSingleton: true) { [self] _ in
LatestBlocksDataProviderImpl(service: service, rustBackend: self.rustBackend)
}
Expand Down

0 comments on commit f3f519b

Please sign in to comment.