prysm-pulse/sharding/utils/service_test.go
Raul Jordan f5e5287082 sharding: Remove Dependency on Geth: Replace Log With Logrus Package (#242)
Former-commit-id: 2ec35880b3aa30d3c217815c9a474e8d81ee1fa8 [formerly c20da02cf9149990f8b7913cfe426b8036992c16]
Former-commit-id: 4851374829557f1523f5994b1d97e08e46979aed
2018-07-09 21:27:23 -05:00

25 lines
476 B
Go

package utils
import (
"errors"
"testing"
logTest "github.com/sirupsen/logrus/hooks/test"
)
func TestHandleServiceErrors(t *testing.T) {
hook := logTest.NewGlobal()
done := make(chan struct{})
errChan := make(chan error)
go HandleServiceErrors(done, errChan)
errChan <- errors.New("something wrong")
done <- struct{}{}
msg := hook.LastEntry().Message
want := "something wrong"
if msg != want {
t.Errorf("incorrect log, expected %s, got %s", want, msg)
}
}