-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
71 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
Blockchain/Tests/BlockchainTests/GuaranteeingServiceTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import Foundation | ||
import Testing | ||
import TracingUtils | ||
import Utils | ||
|
||
@testable import Blockchain | ||
|
||
struct GuaranteeingServiceTests { | ||
func setup( | ||
config: ProtocolConfigRef = .dev, | ||
time: TimeInterval = 988, | ||
keysCount: Int = 12 | ||
) async throws -> (BlockchainServices, GuaranteeingService) { | ||
let services = await BlockchainServices( | ||
config: config, | ||
timeProvider: MockTimeProvider(time: time), | ||
keysCount: keysCount | ||
) | ||
|
||
let extrinsicPoolService = await ExtrinsicPoolService( | ||
config: config, | ||
dataProvider: services.dataProvider, | ||
eventBus: services.eventBus | ||
) | ||
|
||
let runtime = Runtime(config: config) | ||
|
||
let guaranteeingService = await GuaranteeingService( | ||
config: config, | ||
eventBus: services.eventBus, | ||
scheduler: services.scheduler, | ||
dataProvider: services.dataProvider, | ||
keystore: services.keystore, | ||
runtime: runtime, | ||
extrinsicPool: extrinsicPoolService | ||
) | ||
return (services, guaranteeingService) | ||
} | ||
|
||
@Test func onGenesis() async throws { | ||
let (services, validatorService) = try await setup() | ||
let genesisState = services.genesisState | ||
let storeMiddleware = services.storeMiddleware | ||
let scheduler = services.scheduler | ||
|
||
await validatorService.on(genesis: genesisState) | ||
|
||
let events = await storeMiddleware.wait() | ||
|
||
// Check if xxx events were published | ||
|
||
// Check if block author tasks were scheduled | ||
#expect(scheduler.taskCount == 0) | ||
} | ||
} |