diff options
Diffstat (limited to 'events/events_test.go')
-rw-r--r-- | events/events_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/events/events_test.go b/events/events_test.go new file mode 100644 index 00000000..6c501392 --- /dev/null +++ b/events/events_test.go @@ -0,0 +1,22 @@ +package events + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestEvenHandler(t *testing.T) { + eh, id := Bus() + + ch := make(chan Event, 100) + err := eh.SubscribeP(id, "http.EventJobOK", ch) + require.NoError(t, err) + + eh.Send(NewRREvent(EventJobOK, "foo", "http")) + + evt := <-ch + require.Equal(t, "foo", evt.Message()) + require.Equal(t, "http", evt.Plugin()) + require.Equal(t, "EventJobOK", evt.Type().String()) +} |