summaryrefslogtreecommitdiff
path: root/service/injector_test.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-07-08 13:06:05 -0700
committerWolfy-J <[email protected]>2018-07-08 13:06:05 -0700
commit29c9bf94350e86ec96f5ce5eeb476dfcd57302cd (patch)
tree9f59af6446958d144b7de91b5005a3727dc90661 /service/injector_test.go
parent3c3a7801100f29c99a5e446646c818bf16ccd5f0 (diff)
dependency injection and lighter service Init methods.
Diffstat (limited to 'service/injector_test.go')
-rw-r--r--service/injector_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/service/injector_test.go b/service/injector_test.go
new file mode 100644
index 00000000..eaf5fa72
--- /dev/null
+++ b/service/injector_test.go
@@ -0,0 +1,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()
+} \ No newline at end of file