Skip to content

Commit

Permalink
Test local createWants
Browse files Browse the repository at this point in the history
  • Loading branch information
cel authored and cel committed Jul 17, 2017
1 parent 728a1c1 commit c0e9a96
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/local.js
@@ -0,0 +1,32 @@
var tape = require('tape')
var pull = require('pull-stream')
var assert = require('assert')

var u = require('./util')

module.exports = function (createBlobs, createAsync) {

tape('createWants does not error after abort', function (t) {
createAsync(function (async) {
var blobs = createBlobs('simple', async)
var wants = blobs.createWants.call({id: 'test'})
// abort the want stream, and then make another one
wants(new Error('abort'), function (err) {
t.ok(err, 'wants aborted')
pull(
blobs.createWants.call({id: 'test'}),
async.through(),
pull.take(1),
pull.collect(function (err, res) {
t.error(err, 'wants')
t.deepEquals(res, [{}], 'empty wants')
t.end()
})
)
})
})
})

}

if(!module.parent) u.tests(module.exports)

0 comments on commit c0e9a96

Please sign in to comment.