test(notifications)
we expect this to fail. will be fixed in upcoming commit License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
Brian Tiger Chow committed
Nov 21, 2014 at 15:25 UTC
d5e7fd67075d84e7f3d4cb488d7864d21302a08e
1 file changed
+23
exchange/bitswap/notifications/notifications_test.go
+23
@@ -26,6 +26,29 @@ func TestPublishSubscribe(t *testing.T) {
26
27
}
28
29
+func TestSubscribeMany(t *testing.T) {
30
+ e1 := blocks.NewBlock([]byte("Greetings from The Interval"))
31
+ e2 := blocks.NewBlock([]byte("Greetings from The Interval"))
32
+
33
+ n := New()
34
+ defer n.Shutdown()
35
+ ch := n.Subscribe(context.Background(), e1.Key(), e2.Key())
36
+
37
+ n.Publish(e1)
38
+ r1, ok := <-ch
39
+ if !ok {
40
+ t.Fatal("didn't receive first expected block")
41
+ }
42
+ assertBlocksEqual(t, e1, r1)
43
+
44
+ n.Publish(e2)
45
+ r2, ok := <-ch
46
+ if !ok {
47
+ t.Fatal("didn't receive second expected block")
48
+ }
49
+ assertBlocksEqual(t, e2, r2)
50
+}
51
+
52
func TestCarryOnWhenDeadlineExpires(t *testing.T) {
53
54
impossibleDeadline := time.Nanosecond