a683e45855
- Migrate various mocks of core namespaces to shared version in `fakes` pkg - Err on the side of making test doubles less sophisticated - Don't pull over mocks of namespaces that are only used in example code
23 lines
688 B
Go
23 lines
688 B
Go
package history_test
|
|
|
|
import (
|
|
. "github.com/onsi/ginkgo"
|
|
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
|
"github.com/vulcanize/vulcanizedb/pkg/history"
|
|
"math/big"
|
|
)
|
|
|
|
var _ = Describe("Header validator", func() {
|
|
It("attempts to create every header in the validation window", func() {
|
|
headerRepository := fakes.NewMockHeaderRepository()
|
|
headerRepository.SetMissingBlockNumbers([]int64{})
|
|
blockChain := fakes.NewMockBlockChain()
|
|
blockChain.SetLastBlock(big.NewInt(3))
|
|
validator := history.NewHeaderValidator(blockChain, headerRepository, 2)
|
|
|
|
validator.ValidateHeaders()
|
|
|
|
headerRepository.AssertCreateOrUpdateHeaderCallCountAndPassedBlockNumbers(3, []int64{1, 2, 3})
|
|
})
|
|
})
|