test(bitswap:notifications) check if chan is open
Brian Tiger Chow committed
Sep 12, 2014 at 03:28 UTC
2f4175a00d35c57c46d4bda7d2df6eb2d4ebad3f
1 file changed
+5
-1
bitswap/notifications/notifications_test.go
+5
-1
@@ -18,9 +18,13 @@ func TestPublishSubscribe(t *testing.T) {
18
ch := n.Subscribe(context.Background(), blockSent.Key())
19
20
n.Publish(blockSent)
21
- blockRecvd := <-ch
21
+ blockRecvd, ok := <-ch
22
+ if !ok {
23
+ t.Fail()
24
+ }
25
26
assertBlocksEqual(t, blockRecvd, blockSent)
27
+
28
}
29
30
func TestCarryOnWhenDeadlineExpires(t *testing.T) {