mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-28 14:17:17 +00:00
32 lines
567 B
Go
32 lines
567 B
Go
|
package attestations
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"errors"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestStop_OK(t *testing.T) {
|
||
|
s, err := NewService(context.Background(), &Config{})
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
|
||
|
if err := s.Stop(); err != nil {
|
||
|
t.Fatalf("Unable to stop attestation pool service: %v", err)
|
||
|
}
|
||
|
|
||
|
if s.ctx.Err() != context.Canceled {
|
||
|
t.Error("context was not canceled")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestStatus_Error(t *testing.T) {
|
||
|
err := errors.New("bad bad bad")
|
||
|
s := &Service{err: err}
|
||
|
|
||
|
if err := s.Status(); err != s.err {
|
||
|
t.Errorf("Wanted: %v, got: %v", s.err, s.Status())
|
||
|
}
|
||
|
}
|