blob: facc3f7416b334a7a1814cbbd01428737909ee58 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package service
import (
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/assert"
"testing"
)
func TestContainer_Init(t *testing.T) {
logger, hook := test.NewNullLogger()
logger.SetLevel(logrus.DebugLevel)
svc := &testService{ok: true}
c := NewContainer(logger)
c.Register("test", svc)
c.Register("test2", struct{}{})
assert.Equal(t, 2, len(hook.Entries))
assert.NoError(t, c.Serve())
c.Stop()
}
|