1 | var pull = require('../')
|
2 | var test = require('tape')
|
3 |
|
4 |
|
5 | test('join through streams with pipe', function (t) {
|
6 |
|
7 | var map = pull.map
|
8 |
|
9 | var pipeline =
|
10 | pull(
|
11 | map(function (d) {
|
12 |
|
13 | return d + '!'
|
14 | }),
|
15 | map(function (d) {
|
16 |
|
17 | return d.toUpperCase()
|
18 | }),
|
19 | map(function (d) {
|
20 |
|
21 | return '*** ' + d + ' ***'
|
22 | })
|
23 | )
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | t.equal('function', typeof pipeline)
|
29 | t.equal(1, pipeline.length)
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | var read =
|
35 | pull(
|
36 | pull.values(['billy', 'joe', 'zeke']),
|
37 | pipeline
|
38 | )
|
39 |
|
40 | t.equal('function', typeof read)
|
41 |
|
42 |
|
43 | t.equal(2, read.length)
|
44 |
|
45 | pull(
|
46 | read,
|
47 | pull.collect(function (err, array) {
|
48 | console.log(array)
|
49 | t.deepEqual(
|
50 | array,
|
51 | [ '*** BILLY! ***', '*** JOE! ***', '*** ZEKE! ***' ]
|
52 | )
|
53 | t.end()
|
54 | })
|
55 | )
|
56 |
|
57 | })
|