1 | var tape = require('tape')
|
2 | var pull = require('pull-stream')
|
3 | var assert = require('assert')
|
4 |
|
5 | var u = require('./util')
|
6 |
|
7 | module.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 |
|
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 |
|
32 | if(!module.parent) u.tests(module.exports)
|