Skip to content

Commit

Permalink
Merge pull request #20 from bpineau/event_test
Browse files Browse the repository at this point in the history
Unit tests for event
  • Loading branch information
bpineau authored Apr 11, 2018
2 parents ca939f7 + 0b6cc80 commit b361419
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pkg/event/event_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package event

import (
"reflect"
"testing"
)

var (
notif = Notification{
Action: Upsert,
Key: "foo",
Kind: "bar",
Object: "spam egg",
}
)

func TestEvent(t *testing.T) {
ev := New()

go ev.Send(&notif)

reader := ev.ReadChan()
got := <-reader

if !reflect.DeepEqual(notif, got) {
t.Errorf("notification failed: expected %v actual %v", notif, got)
}
}

0 comments on commit b361419

Please sign in to comment.