Skip to content

Commit 0b6cc80

Browse files
committed
Unit tests for event
1 parent ca939f7 commit 0b6cc80

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

pkg/event/event_test.go

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package event
2+
3+
import (
4+
"reflect"
5+
"testing"
6+
)
7+
8+
var (
9+
notif = Notification{
10+
Action: Upsert,
11+
Key: "foo",
12+
Kind: "bar",
13+
Object: "spam egg",
14+
}
15+
)
16+
17+
func TestEvent(t *testing.T) {
18+
ev := New()
19+
20+
go ev.Send(&notif)
21+
22+
reader := ev.ReadChan()
23+
got := <-reader
24+
25+
if !reflect.DeepEqual(notif, got) {
26+
t.Errorf("notification failed: expected %v actual %v", notif, got)
27+
}
28+
}

0 commit comments

Comments
 (0)