UNPKG

873 BJavaScriptView Raw
1var tape = require('tape')
2var pull = require('pull-stream')
3var assert = require('assert')
4
5var u = require('./util')
6
7module.exports = function (createBlobs, createAsync) {
8
9 tape('createWants does not error after abort', function (t) {
10 createAsync(function (async) {
11 var blobs = createBlobs('simple', async)
12 var wants = blobs.createWants.call({id: 'test'})
13 // abort the want stream, and then make another one
14 wants(new Error('abort'), function (err) {
15 t.ok(err, 'wants aborted')
16 pull(
17 blobs.createWants.call({id: 'test'}),
18 async.through(),
19 pull.take(1),
20 pull.collect(function (err, res) {
21 t.error(err, 'wants')
22 t.deepEquals(res, [{}], 'empty wants')
23 t.end()
24 })
25 )
26 })
27 })
28 })
29
30}
31
32if(!module.parent) u.tests(module.exports)