Finish watcher and watcher tests (+fmt)

This commit is contained in:
Edvard
2018-12-11 13:52:02 +01:00
parent d93817f346
commit 5d4239de05
7 changed files with 149 additions and 35 deletions
+1 -3
View File
@@ -19,8 +19,6 @@ import (
"github.com/ethereum/go-ethereum/core/types"
)
// TODO Add unit tests for LogChunker
type LogChunker struct {
AddressToNames map[string][]string
NameToTopic0 map[string]common.Hash
@@ -40,7 +38,7 @@ func NewLogChunker(transformerConfigs []TransformerConfig) LogChunker {
return LogChunker{
AddressToNames: addressToNames,
NameToTopic0: nameToTopic0,
NameToTopic0: nameToTopic0,
}
}
+2 -2
View File
@@ -71,7 +71,7 @@ var _ = Describe("Log chunker", func() {
logs := []types.Log{log1, log2, log3, log4, log5}
chunks := chunker.ChunkLogs(logs)
Expect(chunks["TransformerA"]).To(And(ContainElement(log1),ContainElement(log4)))
Expect(chunks["TransformerA"]).To(And(ContainElement(log1), ContainElement(log4)))
Expect(chunks["TransformerB"]).To(BeEmpty())
Expect(chunks["TransformerC"]).To(ContainElement(log5))
})
@@ -119,4 +119,4 @@ var (
common.HexToHash("0xLogTopic5"),
},
}
)
)
@@ -26,14 +26,7 @@ import (
)
var _ = Describe("Fetcher", func() {
Describe("Iinitialisation", func() {
It("creates correct lookup maps", func() {
})
})
Describe("FetchLogs", func() {
// TODO Add tests for aggregate fetching
It("fetches logs based on the given query", func() {
blockChain := fakes.NewMockBlockChain()
fetcher := shared.NewFetcher(blockChain)