Update old pit file shared config references

This commit is contained in:
Edvard 2018-10-17 12:34:25 +02:00
parent d9b6603109
commit ccca6e0229
2 changed files with 14 additions and 16 deletions

View File

@ -23,20 +23,19 @@ import (
"github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/fakes" "github.com/vulcanize/vulcanizedb/pkg/fakes"
"github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file"
"github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/ilk" "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/ilk"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared" "github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/mocks" "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/mocks"
pit_file_ilk_mocks "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/mocks/pit_file/ilk" ilk_mocks "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/mocks/pit_file/ilk"
) )
var _ = Describe("Pit file ilk transformer", func() { var _ = Describe("Pit file ilk transformer", func() {
var ( var (
config = ilk.IlkFileConfig config = ilk.IlkFileConfig
fetcher mocks.MockLogFetcher fetcher mocks.MockLogFetcher
converter pit_file_ilk_mocks.MockPitFileIlkConverter converter ilk_mocks.MockPitFileIlkConverter
repository pit_file_ilk_mocks.MockPitFileIlkRepository repository ilk_mocks.MockPitFileIlkRepository
transformer shared.Transformer transformer shared.Transformer
headerOne core.Header headerOne core.Header
headerTwo core.Header headerTwo core.Header
@ -44,8 +43,8 @@ var _ = Describe("Pit file ilk transformer", func() {
BeforeEach(func() { BeforeEach(func() {
fetcher = mocks.MockLogFetcher{} fetcher = mocks.MockLogFetcher{}
converter = pit_file_ilk_mocks.MockPitFileIlkConverter{} converter = ilk_mocks.MockPitFileIlkConverter{}
repository = pit_file_ilk_mocks.MockPitFileIlkRepository{} repository = ilk_mocks.MockPitFileIlkRepository{}
headerOne = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()} headerOne = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()}
headerTwo = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()} headerTwo = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()}
transformer = factories.Transformer{ transformer = factories.Transformer{
@ -60,8 +59,8 @@ var _ = Describe("Pit file ilk transformer", func() {
err := transformer.Execute() err := transformer.Execute()
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
Expect(repository.PassedStartingBlockNumber).To(Equal(pit_file.PitFileConfig.StartingBlockNumber)) Expect(repository.PassedStartingBlockNumber).To(Equal(config.StartingBlockNumber))
Expect(repository.PassedEndingBlockNumber).To(Equal(pit_file.PitFileConfig.EndingBlockNumber)) Expect(repository.PassedEndingBlockNumber).To(Equal(config.EndingBlockNumber))
}) })
It("returns error if repository returns error for missing headers", func() { It("returns error if repository returns error for missing headers", func() {
@ -80,7 +79,7 @@ var _ = Describe("Pit file ilk transformer", func() {
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
Expect(fetcher.FetchedBlocks).To(Equal([]int64{headerOne.BlockNumber, headerTwo.BlockNumber})) Expect(fetcher.FetchedBlocks).To(Equal([]int64{headerOne.BlockNumber, headerTwo.BlockNumber}))
Expect(fetcher.FetchedContractAddresses).To(Equal([][]string{pit_file.PitFileConfig.ContractAddresses, pit_file.PitFileConfig.ContractAddresses})) Expect(fetcher.FetchedContractAddresses).To(Equal([][]string{config.ContractAddresses, config.ContractAddresses}))
Expect(fetcher.FetchedTopics).To(Equal([][]common.Hash{{common.HexToHash(shared.PitFileIlkSignature)}})) Expect(fetcher.FetchedTopics).To(Equal([][]common.Hash{{common.HexToHash(shared.PitFileIlkSignature)}}))
}) })

View File

@ -24,7 +24,6 @@ import (
"github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/fakes" "github.com/vulcanize/vulcanizedb/pkg/fakes"
"github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared" "github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/mocks" "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/mocks"
@ -60,8 +59,8 @@ var _ = Describe("Pit file stability fee transformer", func() {
err := transformer.Execute() err := transformer.Execute()
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
Expect(repository.PassedStartingBlockNumber).To(Equal(pit_file.PitFileConfig.StartingBlockNumber)) Expect(repository.PassedStartingBlockNumber).To(Equal(config.StartingBlockNumber))
Expect(repository.PassedEndingBlockNumber).To(Equal(pit_file.PitFileConfig.EndingBlockNumber)) Expect(repository.PassedEndingBlockNumber).To(Equal(config.EndingBlockNumber))
}) })
It("returns error if repository returns error for missing headers", func() { It("returns error if repository returns error for missing headers", func() {
@ -79,7 +78,7 @@ var _ = Describe("Pit file stability fee transformer", func() {
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
Expect(fetcher.FetchedBlocks).To(Equal([]int64{headerOne.BlockNumber, headerTwo.BlockNumber})) Expect(fetcher.FetchedBlocks).To(Equal([]int64{headerOne.BlockNumber, headerTwo.BlockNumber}))
Expect(fetcher.FetchedContractAddresses).To(Equal([][]string{ Expect(fetcher.FetchedContractAddresses).To(Equal([][]string{
pit_file.PitFileConfig.ContractAddresses, pit_file.PitFileConfig.ContractAddresses})) config.ContractAddresses, config.ContractAddresses}))
Expect(fetcher.FetchedTopics).To(Equal([][]common.Hash{{common.HexToHash(shared.PitFileStabilityFeeSignature)}})) Expect(fetcher.FetchedTopics).To(Equal([][]common.Hash{{common.HexToHash(shared.PitFileStabilityFeeSignature)}}))
}) })