From d5e7fd67075d84e7f3d4cb488d7864d21302a08e Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Fri, 21 Nov 2014 15:25:37 -0800 Subject: [PATCH] test(notifications) we expect this to fail. will be fixed in upcoming commit License: MIT Signed-off-by: Brian Tiger Chow --- .../notifications/notifications_test.go | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/exchange/bitswap/notifications/notifications_test.go b/exchange/bitswap/notifications/notifications_test.go index ebbae2a51..5c51f322e 100644 --- a/exchange/bitswap/notifications/notifications_test.go +++ b/exchange/bitswap/notifications/notifications_test.go @@ -26,6 +26,29 @@ func TestPublishSubscribe(t *testing.T) { } +func TestSubscribeMany(t *testing.T) { + e1 := blocks.NewBlock([]byte("Greetings from The Interval")) + e2 := blocks.NewBlock([]byte("Greetings from The Interval")) + + n := New() + defer n.Shutdown() + ch := n.Subscribe(context.Background(), e1.Key(), e2.Key()) + + n.Publish(e1) + r1, ok := <-ch + if !ok { + t.Fatal("didn't receive first expected block") + } + assertBlocksEqual(t, e1, r1) + + n.Publish(e2) + r2, ok := <-ch + if !ok { + t.Fatal("didn't receive second expected block") + } + assertBlocksEqual(t, e2, r2) +} + func TestCarryOnWhenDeadlineExpires(t *testing.T) { impossibleDeadline := time.Nanosecond