• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const { mustNotMutateObjectDeep } = require('../common');
3
4const assert = require('assert');
5const fs = require('fs');
6
7{
8  const fd = 'k';
9
10  assert.throws(
11    () => {
12      fs.createReadStream(null, mustNotMutateObjectDeep({ fd }));
13    },
14    {
15      code: 'ERR_INVALID_ARG_TYPE',
16      name: 'TypeError',
17    });
18
19  assert.throws(
20    () => {
21      fs.createWriteStream(null, mustNotMutateObjectDeep({ fd }));
22    },
23    {
24      code: 'ERR_INVALID_ARG_TYPE',
25      name: 'TypeError',
26    });
27}
28
29{
30  const path = 46;
31
32  assert.throws(
33    () => {
34      fs.createReadStream(path);
35    },
36    {
37      code: 'ERR_INVALID_ARG_TYPE',
38      name: 'TypeError',
39    });
40
41  assert.throws(
42    () => {
43      fs.createWriteStream(path);
44    },
45    {
46      code: 'ERR_INVALID_ARG_TYPE',
47      name: 'TypeError',
48    });
49}
50