git ssb

2+

Dominic / pull-stream



Tree: 2d4523dffda72662b6872ac393ee20e811eee7b1

Files: 2d4523dffda72662b6872ac393ee20e811eee7b1 / test / values.js

749 bytesRaw
1
2
3var pull = require('../')
4var tape = require('tape')
5
6tape('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
17tape('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
29tape('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