2023-11-02 15:51:21 +00:00
|
|
|
package mock
|
|
|
|
|
2024-02-15 05:46:47 +00:00
|
|
|
import "github.com/prysmaticlabs/prysm/v5/async/event"
|
2023-11-02 15:51:21 +00:00
|
|
|
|
|
|
|
type MockStreamer struct {
|
|
|
|
logs [][]byte
|
|
|
|
feed *event.Feed
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewMockStreamer creates a new instance of MockStreamer.
|
|
|
|
// It's useful to set up the default state for the mock, like initializing the feed.
|
|
|
|
func NewMockStreamer(logs [][]byte) *MockStreamer {
|
|
|
|
return &MockStreamer{
|
|
|
|
logs: logs,
|
|
|
|
feed: new(event.Feed),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetLastFewLogs returns the predefined logs.
|
|
|
|
func (m *MockStreamer) GetLastFewLogs() [][]byte {
|
|
|
|
return m.logs
|
|
|
|
}
|
|
|
|
|
|
|
|
// LogsFeed returns the predefined event feed.
|
|
|
|
func (m *MockStreamer) LogsFeed() *event.Feed {
|
|
|
|
return m.feed
|
|
|
|
}
|