node/test/parallel/test-fs-rmdir-type-check.js
James M Snell 6100e12667 fs: move type checking to js
PR-URL: https://github.com/nodejs/node/pull/17667
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-12-22 12:49:10 -08:00

22 lines
404 B
JavaScript

'use strict';
const common = require('../common');
const fs = require('fs');
[false, 1, [], {}, null, undefined].forEach((i) => {
common.expectsError(
() => fs.rmdir(i, common.mustNotCall()),
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError
}
);
common.expectsError(
() => fs.rmdirSync(i),
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError
}
);
});