mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-31 23:41:22 +00:00
2a612de3c5
Former-commit-id: ff13be57aab24129a97f359464fb5b8154c5a206 [formerly ff9566d3bd5653b23fc2846b26e1b07a15fdc159] Former-commit-id: 371821f0ad0bb76640eed2199f5dc49f979d14d8
30 lines
624 B
Go
30 lines
624 B
Go
package sharding
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/ethereum/go-ethereum/core/types"
|
|
)
|
|
|
|
type FakeClient struct {
|
|
client *FakeEthClient
|
|
}
|
|
|
|
type FakeEthClient struct{}
|
|
|
|
type FakeSubscription struct{}
|
|
|
|
func (ec *FakeEthClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (FakeSubscription, error) {
|
|
return FakeSubscription{}, fmt.Errorf("error, network disconnected!")
|
|
}
|
|
|
|
func TestSubscribeHeaders(t *testing.T) {
|
|
client := &FakeClient{client: &FakeEthClient{}}
|
|
err := subscribeBlockHeaders(client)
|
|
if err != nil {
|
|
t.Errorf("subscribe new headers should work", "no error", err)
|
|
}
|
|
}
|