Skip to content

Commit

Permalink
fixup! restore tests
Browse files Browse the repository at this point in the history
  • Loading branch information
debadree25 committed Jan 14, 2023
1 parent 03f3748 commit e036f56
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
20 changes: 20 additions & 0 deletions test/parallel/test-stream-end-of-streams.js
@@ -0,0 +1,20 @@
'use strict';
require('../common');
const assert = require('assert');

const { Duplex, finished } = require('stream');

assert.throws(
() => {
// Passing empty object to mock invalid stream
// should throw error
finished({}, () => {});
},
{ code: 'ERR_INVALID_ARG_TYPE' }
);

const streamObj = new Duplex();
streamObj.end();
// Below code should not throw any errors as the
// streamObj is `Stream`
finished(streamObj, () => {});
7 changes: 6 additions & 1 deletion test/parallel/test-stream-finished.js
Expand Up @@ -260,7 +260,12 @@ const http = require('http');
const streamLike = new EE();
streamLike.readableEnded = true;
streamLike.readable = true;
finished(streamLike, common.mustCall());
assert.throws(
() => {
finished(streamLike, () => {});
},
{ code: 'ERR_INVALID_ARG_TYPE' }
);
streamLike.emit('close');
}

Expand Down

0 comments on commit e036f56

Please sign in to comment.