Son CV dans un terminal web en Javascript! https://terminal-cv.gregandev.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1003 B

1 year ago
var test = require('tape');
var pipeline = require('..').pipeline;
var stream = require('..');
var Buffer = require('safe-buffer').Buffer;
test('supports pipeline', function(t) {
t.plan(4);
var readable = new stream.Readable({
read: function () {
this.push(Buffer.from('chunk', 'ascii'));
}
});
var transform1 = new stream.Transform({
transform: function (chunk, enc, cb) {
cb(new Error('fail'));
}
});
var transform2 = new stream.PassThrough();
transform2.on('close', function () {
t.pass('transform2.close called');
});
var writable = new stream.Writable({
write: function (chunk, enc, cb) { cb(); }
});
writable.on('close', function () {
t.pass('writable.close called');
});
pipeline(
readable,
transform1,
transform2,
writable,
function(err) {
t.ok(err);
t.equal(err.message, 'fail');
});
});