summaryrefslogtreecommitdiff
path: root/service/injector_test.go
blob: eaf5fa72ae49ed1f6cb3d64f26f1078b105acf30 (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 (
	"testing"
	"github.com/stretchr/testify/assert"
	"v/github.com/sirupsen/[email protected]/hooks/test"
	"github.com/sirupsen/logrus"
)

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()
}