Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Кирилл committed Nov 9, 2023
1 parent c971e8d commit d1f5a0d
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ import java.io.File
import java.net.URI
import java.time.Duration

class GenericRpcConnectorTest {
class GenericConnectorFactoryCreatorTest {

@ParameterizedTest
@MethodSource("data")
fun `rpc head poll interval must equal to expected-block-time`(
expectedBlockTime: Duration,
config: ChainsConfig.ChainConfig
config: ChainsConfig.ChainConfig,
) {
val factory = GenericConnectorFactoryCreator(
FileResolver(File("")), immediate(), immediate(), immediate(), immediate()
FileResolver(File("")),
immediate(),
immediate(),
immediate(),
immediate(),
)
var args: List<*>? = null

Expand All @@ -41,14 +45,16 @@ class GenericRpcConnectorTest {
factory.createConnectorFactoryCreator(
"id",
UpstreamsConfig.RpcConnection(
UpstreamsConfig.HttpEndpoint(URI("http://localhost"))
UpstreamsConfig.HttpEndpoint(URI("http://localhost")),
),
Chain.ETHEREUM__MAINNET, AlwaysForkChoice(),
BlockValidator.ALWAYS_VALID, config
Chain.ETHEREUM__MAINNET,
AlwaysForkChoice(),
BlockValidator.ALWAYS_VALID,
config,
)?.create(mock<DefaultUpstream> { on { getId() } doReturn "id" }, Chain.ETHEREUM__MAINNET)

assertEquals(expectedBlockTime, args?.get(6))
}
}
}

companion object {
Expand All @@ -57,7 +63,9 @@ class GenericRpcConnectorTest {
@JvmStatic
fun data(): List<Arguments> = chainsConfigReader.read(null)
.flatMap { cfg ->
cfg.shortNames.map { Arguments.of(cfg.expectedBlockTime, cfg) }
cfg.shortNames.map {
Arguments.of(cfg.expectedBlockTime, cfg)
}
}
}
}

0 comments on commit d1f5a0d

Please sign in to comment.