Exemplo n.º 1
0
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)

}
Exemplo n.º 2
0
func TestEventStructShouldHaveEventID(t *testing.T) {
	e := eventa.NewEvent("test::Event")
	assert(t, e.Name == "test::Event", "Event Name is not set properly")
}