1'use strict';
2require('../common');
3const assert = require('assert');
4
5const { Duplex, finished } = require('stream');
6
7assert.throws(
8  () => {
9    // Passing empty object to mock invalid stream
10    // should throw error
11    finished({}, () => {});
12  },
13  { code: 'ERR_INVALID_ARG_TYPE' }
14);
15
16const streamObj = new Duplex();
17streamObj.end();
18// Below code should not throw any errors as the
19// streamObj is `Stream`
20finished(streamObj, () => {});
21