Blame view
node_modules/mux-demux/test/error.js
717 Bytes
f7563de62
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
var MuxDemux = require('../') var through = require('event-stream').through //make a through stream that is delayed by one tick require('tape')(function (t) { function tick () { var stream return stream = through(function (data) { process.nextTick(function () { stream.emit('data', data) }) }, function () { process.nextTick(function () { stream.emit('end', data) }) }) } var A = MuxDemux() var B = MuxDemux() var errored = false A.pipe(tick()).pipe(B).pipe(tick()).pipe(A) var a = A.createStream('test') .on('error', function (err) { errored = true console.log('expected error:', err.message) t.notEqual(err, null, 'expected an error') t.end() }) }) |