Files: d2f2697f296dd39aed6a8b63c6d04a736a7db5b3 / node_modules / pull-stream / test / values.js
749 bytesRaw
1 | |
2 | |
3 | var pull = require('../') |
4 | var tape = require('tape') |
5 | |
6 | tape('values - array', function (t) { |
7 | pull( |
8 | pull.values([1,2,3]), |
9 | pull.collect(function (err, ary) { |
10 | t.notOk(err) |
11 | t.deepEqual(ary, [1, 2, 3]) |
12 | t.end() |
13 | }) |
14 | ) |
15 | }) |
16 | |
17 | tape('values - object', function (t) { |
18 | pull( |
19 | pull.values({a:1,b:2,c:3}), |
20 | pull.collect(function (err, ary) { |
21 | t.notOk(err) |
22 | t.deepEqual(ary, [1, 2, 3]) |
23 | t.end() |
24 | }) |
25 | ) |
26 | |
27 | }) |
28 | |
29 | tape('values, abort', function (t) { |
30 | |
31 | t.plan(3) |
32 | |
33 | var err = new Error('intentional') |
34 | |
35 | var read = pull.values([1,2,3], function (err) { |
36 | t.end() |
37 | }) |
38 | |
39 | read(null, function (_, one) { |
40 | t.notOk(_) |
41 | t.equal(one, 1) |
42 | read(err, function (_err) { |
43 | t.equal(_err, err) |
44 | }) |
45 | }) |
46 | |
47 | }) |
48 |
Built with git-ssb-web