From a5fccaccee4f5dbbc505be79624d24028697db5f Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Fri, 21 Nov 2014 17:21:03 -0800 Subject: [PATCH] tests(bitswap/notifications) test niladic License: MIT Signed-off-by: Brian Tiger Chow --- exchange/bitswap/notifications/notifications_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/exchange/bitswap/notifications/notifications_test.go b/exchange/bitswap/notifications/notifications_test.go index 5c51f322e..7352320d9 100644 --- a/exchange/bitswap/notifications/notifications_test.go +++ b/exchange/bitswap/notifications/notifications_test.go @@ -49,6 +49,15 @@ func TestSubscribeMany(t *testing.T) { assertBlocksEqual(t, e2, r2) } +func TestSubscribeIsANoopWhenCalledWithNoKeys(t *testing.T) { + n := New() + defer n.Shutdown() + ch := n.Subscribe(context.TODO()) // no keys provided + if _, ok := <-ch; ok { + t.Fatal("should be closed if no keys provided") + } +} + func TestCarryOnWhenDeadlineExpires(t *testing.T) { impossibleDeadline := time.Nanosecond