prysm-pulse/beacon-chain/operations/attestations/service_test.go
Radosław Kapka 47fdb3b99a
Revert "Rename NewService to New (#8337)" (#8440)
* Revert "Rename `NewService` to `New` (#8337)"

This reverts commit d121b19145.

# Conflicts:
#	beacon-chain/sync/initial-sync/round_robin_test.go

* fix name in test

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2021-02-12 17:45:22 +00:00

24 lines
614 B
Go

package attestations
import (
"context"
"errors"
"testing"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
)
func TestStop_OK(t *testing.T) {
s, err := NewService(context.Background(), &Config{})
require.NoError(t, err)
require.NoError(t, s.Stop(), "Unable to stop attestation pool service")
assert.ErrorContains(t, context.Canceled.Error(), s.ctx.Err(), "Context was not canceled")
}
func TestStatus_Error(t *testing.T) {
err := errors.New("bad bad bad")
s := &Service{err: err}
assert.ErrorContains(t, s.err.Error(), s.Status())
}