Skip to content

Commit

Permalink
stream: test that multiple streams can be unpiped in the reverse orde…
Browse files Browse the repository at this point in the history
…r from which they were piped
  • Loading branch information
Niels Nielsen committed Oct 18, 2016
1 parent 0e6750d commit bc88190
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/parallel/test-stream-unpipe-multiple-pipes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';
const common = require('../common');
const stream = require('stream');

const source = stream.Readable({read: () => {}});
const dest1 = stream.Writable({write: () => {}});
const dest2 = stream.Writable({write: () => {}});

source.pipe(dest1);
source.pipe(dest2);

dest1.on('unpipe', common.mustCall(() => {}));
dest2.on('unpipe', common.mustCall(() => {}));

//should be able to unpipe them in the reverse order that they were piped
source.unpipe(dest2);
source.unpipe(dest1);

0 comments on commit bc88190

Please sign in to comment.