prysm-pulse/beacon-chain/attestation/service_test.go
2018-10-17 01:11:24 -05:00

31 lines
778 B
Go

package attestation
import (
"context"
"testing"
btestutil "github.com/prysmaticlabs/prysm/beacon-chain/testutil"
"github.com/prysmaticlabs/prysm/beacon-chain/types"
"github.com/prysmaticlabs/prysm/shared/testutil"
logTest "github.com/sirupsen/logrus/hooks/test"
)
func TestIncomingAttestations(t *testing.T) {
hook := logTest.NewGlobal()
beaconDB := btestutil.SetupDB(t)
defer btestutil.TeardownDB(t, beaconDB)
service := NewAttestationService(context.Background(), &Config{BeaconDB: beaconDB})
exitRoutine := make(chan bool)
go func() {
service.aggregateAttestations()
<-exitRoutine
}()
service.incomingChan <- types.NewAttestation(nil)
service.cancel()
exitRoutine <- true
testutil.AssertLogsContain(t, hook, "Forwarding aggregated attestation")
}