func TestCallbackTriggered(t *testing.T) { incoming := make(chan string) printEvent := func(l *eventa.Listener, data whatever.Params) { incoming <- data.Get("message") } l := eventa.NewListener() l.On("32", printEvent) e := eventa.NewEvent("32") e.Params.Add("message", "Hello World") l.Emit(e) equals(t, "Hello World", <-incoming) }
func TestEventStructShouldHaveEventID(t *testing.T) { e := eventa.NewEvent("test::Event") assert(t, e.Name == "test::Event", "Event Name is not set properly") }