Compare commits

...

2 Commits

Author SHA1 Message Date
wpetit fe90d81b5d chore: fix goweb tests 2020-11-16 19:12:29 +01:00
wpetit 9343970672 chore: fix cqrs tests 2020-11-16 19:12:13 +01:00
3 changed files with 9 additions and 7 deletions

View File

@ -10,7 +10,7 @@ type testCommandRequest struct {
} }
func TestSimpleCommandExec(t *testing.T) { func TestSimpleCommandExec(t *testing.T) {
bus := NewBus() dispatcher := NewDispatcher()
handlerCalled := false handlerCalled := false
@ -19,7 +19,7 @@ func TestSimpleCommandExec(t *testing.T) {
return nil return nil
} }
bus.RegisterCommand( dispatcher.RegisterCommand(
MatchCommandRequest(&testCommandRequest{}), MatchCommandRequest(&testCommandRequest{}),
CommandHandlerFunc(handleTestCommand), CommandHandlerFunc(handleTestCommand),
) )
@ -29,7 +29,7 @@ func TestSimpleCommandExec(t *testing.T) {
} }
ctx := context.Background() ctx := context.Background()
result, err := bus.Exec(ctx, cmd) result, err := dispatcher.Exec(ctx, cmd)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }

View File

@ -6,7 +6,7 @@ import (
) )
func TestBasicCommandMiddleware(t *testing.T) { func TestBasicCommandMiddleware(t *testing.T) {
bus := NewBus() dispatcher := NewDispatcher()
handlerCalled := false handlerCalled := false
@ -26,7 +26,7 @@ func TestBasicCommandMiddleware(t *testing.T) {
return CommandHandlerFunc(fn) return CommandHandlerFunc(fn)
} }
bus.RegisterCommand( dispatcher.RegisterCommand(
MatchCommandRequest(&testCommandRequest{}), MatchCommandRequest(&testCommandRequest{}),
CommandHandlerFunc(handleTestCommand), CommandHandlerFunc(handleTestCommand),
commandMiddleware, commandMiddleware,
@ -37,7 +37,7 @@ func TestBasicCommandMiddleware(t *testing.T) {
} }
ctx := context.Background() ctx := context.Background()
result, err := bus.Exec(ctx, cmd) result, err := dispatcher.Exec(ctx, cmd)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }

View File

@ -20,7 +20,9 @@ func Example_usage() {
// On expose le service "template" avec l'implémentation // On expose le service "template" avec l'implémentation
// basée sur le moteur de rendu HTML de la librairie standard // basée sur le moteur de rendu HTML de la librairie standard
container.Provide(template.ServiceName, html.ServiceProvider("./templates")) container.Provide(template.ServiceName, html.ServiceProvider(
html.NewDirectoryLoader("./templates"),
))
router := chi.NewRouter() router := chi.NewRouter()