summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-unlink-type-check.js
blob: 7fe3ce946c89d5adbd02b0b6e7297da54177b950 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'use strict';

const common = require('../common');
const fs = require('fs');

[false, 1, {}, [], null, undefined].forEach((i) => {
  common.expectsError(
    () => fs.unlink(i, common.mustNotCall()),
    {
      code: 'ERR_INVALID_ARG_TYPE',
      type: TypeError
    }
  );
  common.expectsError(
    () => fs.unlinkSync(i),
    {
      code: 'ERR_INVALID_ARG_TYPE',
      type: TypeError
    }
  );
});