summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-rename-type-check.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-fs-rename-type-check.js')
-rw-r--r--test/parallel/test-fs-rename-type-check.js40
1 files changed, 19 insertions, 21 deletions
diff --git a/test/parallel/test-fs-rename-type-check.js b/test/parallel/test-fs-rename-type-check.js
index 68126e9f7e..b8f0549f0c 100644
--- a/test/parallel/test-fs-rename-type-check.js
+++ b/test/parallel/test-fs-rename-type-check.js
@@ -1,43 +1,41 @@
'use strict';
const common = require('../common');
+const assert = require('assert');
const fs = require('fs');
-[false, 1, [], {}, null, undefined].forEach((i) => {
- common.expectsError(
- () => fs.rename(i, 'does-not-exist', common.mustNotCall()),
+[false, 1, [], {}, null, undefined].forEach((input) => {
+ const type = `of type string, Buffer, or URL. Received type ${typeof input}`;
+ assert.throws(
+ () => fs.rename(input, 'does-not-exist', common.mustNotCall()),
{
code: 'ERR_INVALID_ARG_TYPE',
- type: TypeError,
- message:
- 'The "oldPath" argument must be one of type string, Buffer, or URL'
+ name: 'TypeError [ERR_INVALID_ARG_TYPE]',
+ message: `The "oldPath" argument must be one ${type}`
}
);
- common.expectsError(
- () => fs.rename('does-not-exist', i, common.mustNotCall()),
+ assert.throws(
+ () => fs.rename('does-not-exist', input, common.mustNotCall()),
{
code: 'ERR_INVALID_ARG_TYPE',
- type: TypeError,
- message:
- 'The "newPath" argument must be one of type string, Buffer, or URL'
+ name: 'TypeError [ERR_INVALID_ARG_TYPE]',
+ message: `The "newPath" argument must be one ${type}`
}
);
- common.expectsError(
- () => fs.renameSync(i, 'does-not-exist'),
+ assert.throws(
+ () => fs.renameSync(input, 'does-not-exist'),
{
code: 'ERR_INVALID_ARG_TYPE',
- type: TypeError,
- message:
- 'The "oldPath" argument must be one of type string, Buffer, or URL'
+ name: 'TypeError [ERR_INVALID_ARG_TYPE]',
+ message: `The "oldPath" argument must be one ${type}`
}
);
- common.expectsError(
- () => fs.renameSync('does-not-exist', i),
+ assert.throws(
+ () => fs.renameSync('does-not-exist', input),
{
code: 'ERR_INVALID_ARG_TYPE',
- type: TypeError,
- message:
- 'The "newPath" argument must be one of type string, Buffer, or URL'
+ name: 'TypeError [ERR_INVALID_ARG_TYPE]',
+ message: `The "newPath" argument must be one ${type}`
}
);
});