blob: 80a39d052bf8b440e5f81e0c4f560d192568054f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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, () => {});
|