Skip to content
This repository has been archived by the owner on Oct 21, 2023. It is now read-only.

Commit

Permalink
test: add eb to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dtomasi committed Sep 6, 2021
1 parent 5e12ae8 commit cff33b6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit cff33b6

Please # to comment.