Skip to content

Commit cfa4fed

Browse files
committed
add test for end() corner case
1 parent 7f42cd2 commit cfa4fed

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/index.js

+19
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,22 @@ tape('end', function (t) {
5656
t.equal(notify(r), r)
5757
notify.end()
5858
})
59+
60+
tape('end immediately upon delivery', function (t) {
61+
var notify = Notify()
62+
var r = Math.random()
63+
var n = 1
64+
65+
pull(
66+
notify.listen(),
67+
pull.drain(function (data) {
68+
t.equal(data, r)
69+
notify.end()
70+
}, function () {
71+
if (--n) return
72+
t.end()
73+
})
74+
)
75+
76+
t.equal(notify(r), r)
77+
})

0 commit comments

Comments
 (0)