diff --git a/dispatcher_test.go b/dispatcher_test.go index b266481..fd486ff 100644 --- a/dispatcher_test.go +++ b/dispatcher_test.go @@ -136,6 +136,17 @@ func Test_UnknownEvent(t *testing.T) { } } +func Test_DispatchEventWithError(t *testing.T) { + d := NewDispatcher() + d.RegisterCommandHandler(testCommand{}, &testCommandHandler{}) + d.RegisterEventHandler(testEvent{}, &testErrorEventHandler{}) + + err := d.DispatchEvent(context.Background(), testEvent{}) + if err == nil { + t.Fatal("expected error") + } +} + func Test_Error(t *testing.T) { d := NewDispatcher() d.RegisterCommandHandler(testCommand{}, &testErrorHandler{})