72a849a272
- currently not validating price feeds if the underlying header already exists and is valid, since price feeds should have been added when initial header was added
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package fakes
|
|
|
|
import (
|
|
. "github.com/onsi/gomega"
|
|
|
|
"github.com/vulcanize/vulcanizedb/pkg/core"
|
|
)
|
|
|
|
type MockTransformer struct {
|
|
passedHeader core.Header
|
|
passedHeaderID int64
|
|
executeCalled bool
|
|
executeErr error
|
|
}
|
|
|
|
func NewMockTransformer() *MockTransformer {
|
|
return &MockTransformer{
|
|
passedHeader: core.Header{},
|
|
passedHeaderID: 0,
|
|
executeCalled: false,
|
|
executeErr: nil,
|
|
}
|
|
}
|
|
|
|
func (transformer *MockTransformer) SetExecuteErr(err error) {
|
|
transformer.executeErr = err
|
|
}
|
|
|
|
func (transformer *MockTransformer) Execute(header core.Header, headerID int64) error {
|
|
transformer.executeCalled = true
|
|
transformer.passedHeader = header
|
|
transformer.passedHeaderID = headerID
|
|
return transformer.executeErr
|
|
}
|
|
|
|
func (transformer *MockTransformer) AssertExecuteCalledWith(header core.Header, headerID int64) {
|
|
Expect(transformer.executeCalled).To(BeTrue())
|
|
Expect(header).To(Equal(transformer.passedHeader))
|
|
Expect(headerID).To(Equal(transformer.passedHeaderID))
|
|
}
|
|
|
|
func (tranformer *MockTransformer) AssertExecuteNotCalled() {
|
|
Expect(tranformer.executeCalled).To(BeFalse())
|
|
}
|