From cff33b6349837ffdc907e2296c22dec660e00937 Mon Sep 17 00:00:00 2001 From: Dominik Tomasi Date: Mon, 6 Sep 2021 14:12:02 +0200 Subject: [PATCH] test: add eb to tests --- container_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/container_test.go b/container_test.go index ccf9bca..9ec393d 100644 --- a/container_test.go +++ b/container_test.go @@ -2,8 +2,10 @@ package di_test import ( "context" + "fmt" "github.com/dtomasi/di" "github.com/dtomasi/fakr" + eventbus "github.com/dtomasi/go-event-bus/v2" "github.com/go-logr/logr" "github.com/stretchr/testify/assert" "math/rand" @@ -96,10 +98,17 @@ func (m *ParameterProviderMock) Set(_ string, _ interface{}) error { } func BuildContainer() (*di.Container, error) { + eb := eventbus.NewEventBus() + + eb.SubscribeCallback(di.EventTopicDIReady.String(), func(topic string, data interface{}) { + fmt.Println("container ready") //nolint:forbidigo + }) + container := di.NewServiceContainer( di.WithContext(context.Background()), di.WithParameterProvider(&ParameterProviderMock{}), di.WithLogrImpl(fakr.New()), + di.WithEventBus(eb), ) container.Register(