Skip to content

Commit

Permalink
[ETCM-283] Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkoAlic committed Nov 19, 2020
1 parent 397d0bd commit e48c144
Showing 1 changed file with 4 additions and 6 deletions.
Expand Up @@ -3,10 +3,7 @@ package io.iohk.ethereum.blockchain.sync.regular
import akka.actor.ActorSystem
import akka.testkit.{TestKit, TestProbe}
import io.iohk.ethereum.Mocks.MockValidatorsAlwaysSucceed
import io.iohk.ethereum.domain.Block
import io.iohk.ethereum.BlockHelpers
import io.iohk.ethereum.Fixtures.Blocks.ValidBlock
import io.iohk.ethereum.domain.Block
import io.iohk.ethereum.network.PeerId
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpecLike
Expand All @@ -30,11 +27,12 @@ class BlockFetcherStateSpec extends TestKit(ActorSystem()) with AnyWordSpecLike

"handling requested blocks" should {
"clear headers queue if got empty list of blocks" in {
val importer = TestProbe().ref
val headers = BlockHelpers.generateChain(5, BlockHelpers.genesis).map(_.header)
val peer = PeerId("foo")

val result = BlockFetcherState
.initial(TestProbe().ref, 0)
.initial(importer, validators.blockValidator, 0)
.appendHeaders(headers)
.map(_.handleRequestedBlocks(peer, List()))
.map(_.waitingHeaders)
Expand All @@ -44,12 +42,12 @@ class BlockFetcherStateSpec extends TestKit(ActorSystem()) with AnyWordSpecLike
}

"enqueue requested blocks" in {

val importer = TestProbe().ref
val blocks = BlockHelpers.generateChain(5, BlockHelpers.genesis)
val peer = PeerId("foo")

val result = BlockFetcherState
.initial(TestProbe().ref, 0)
.initial(importer, validators.blockValidator, 0)
.appendHeaders(blocks.map(_.header))
.map(_.handleRequestedBlocks(peer, blocks.map(_.body)))

Expand Down

0 comments on commit e48c144

Please sign in to comment.