git ssb

2+

Dominic / pull-stream



Tree: 0638fd964786330ea637fe10af73a9474d43493d

Files: 0638fd964786330ea637fe10af73a9474d43493d / test / drain-if.js

701 bytesRaw
1
2var pull = require('../')
3var test = require('tape')
4
5test('reduce becomes through', function (t) {
6 pull(
7 pull.values([1,2,3]),
8 pull.reduce(function (a, b) {return a + b}, 0, function (err, val) {
9 t.equal(val, 6)
10 t.end()
11 })
12 )
13})
14
15test('reduce without initial value', function (t) {
16 pull(
17 pull.values([1,2,3]),
18 pull.reduce(function (a, b) {return a + b}, function (err, val) {
19 t.equal(val, 6)
20 t.end()
21 })
22 )
23})
24
25
26test('reduce becomes drain', function (t) {
27 pull(
28 pull.values([1,2,3]),
29 pull.reduce(
30 function (a, b) {return a + b},
31 0,
32 function (err, acc) {
33 t.equal(acc, 6)
34 t.end()
35 }
36 )
37 )
38})
39
40
41

Built with git-ssb-web