From 298bd77be7a3c45d0b167958cc032f36c25825f4 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Tue, 22 Oct 2024 23:08:06 +1300 Subject: [PATCH] improve tests --- .../Tests/BlockchainTests/ValidatorServiceTests.swift | 7 +++++-- Utils/Sources/Utils/FixedSizeData.swift | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Blockchain/Tests/BlockchainTests/ValidatorServiceTests.swift b/Blockchain/Tests/BlockchainTests/ValidatorServiceTests.swift index ecbb4ad8..07c74cc2 100644 --- a/Blockchain/Tests/BlockchainTests/ValidatorServiceTests.swift +++ b/Blockchain/Tests/BlockchainTests/ValidatorServiceTests.swift @@ -89,7 +89,7 @@ struct ValidatorServiceTests { } // try different genesis time offset to ensure edge cases are covered - @Test(arguments: [988, 1000, 1003, 1020]) + @Test(arguments: [988, 1000, 1003, 1021]) func makeManyBlocks(time: Int) async throws { let (services, validatorService) = try await setup(time: TimeInterval(time)) let genesisState = services.genesisState @@ -101,7 +101,10 @@ struct ValidatorServiceTests { await storeMiddleware.wait() - await scheduler.advance(by: TimeInterval(config.value.slotPeriodSeconds) * 25 - 1) + for _ in 0 ..< 25 { + await scheduler.advance(by: TimeInterval(config.value.slotPeriodSeconds)) + await storeMiddleware.wait() // let events to be processed + } let events = await storeMiddleware.wait() diff --git a/Utils/Sources/Utils/FixedSizeData.swift b/Utils/Sources/Utils/FixedSizeData.swift index 3e2222a7..8503b8e9 100644 --- a/Utils/Sources/Utils/FixedSizeData.swift +++ b/Utils/Sources/Utils/FixedSizeData.swift @@ -42,7 +42,7 @@ extension FixedSizeData: CustomStringConvertible, CustomDebugStringConvertible { } public var debugDescription: String { - "Data\(T.value)(\(description))" + description } }