mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
242cbd7d1a
PR-URL: https://github.com/nodejs/node/pull/50611 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
34 lines
620 B
JavaScript
34 lines
620 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
|
|
const prefixValues = [undefined, null, 0, true, false, 1];
|
|
|
|
function fail(value) {
|
|
assert.throws(
|
|
() => {
|
|
fs.mkdtempSync(value, {});
|
|
},
|
|
{
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
name: 'TypeError'
|
|
});
|
|
}
|
|
|
|
function failAsync(value) {
|
|
assert.throws(
|
|
() => {
|
|
fs.mkdtemp(value, common.mustNotCall());
|
|
},
|
|
{
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
name: 'TypeError'
|
|
});
|
|
}
|
|
|
|
for (const prefixValue of prefixValues) {
|
|
fail(prefixValue);
|
|
failAsync(prefixValue);
|
|
}
|