summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-link.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-fs-link.js')
-rw-r--r--test/parallel/test-fs-link.js43
1 files changed, 30 insertions, 13 deletions
diff --git a/test/parallel/test-fs-link.js b/test/parallel/test-fs-link.js
index 525392aa2b..7cbfe5a15e 100644
--- a/test/parallel/test-fs-link.js
+++ b/test/parallel/test-fs-link.js
@@ -21,16 +21,33 @@ fs.link(srcPath, dstPath, common.mustCall(callback));
// test error outputs
-assert.throws(
- function() {
- fs.link();
- },
- /src must be a string or Buffer/
-);
-
-assert.throws(
- function() {
- fs.link('abc');
- },
- /dest must be a string or Buffer/
-);
+[false, 1, [], {}, null, undefined].forEach((i) => {
+ common.expectsError(
+ () => fs.link(i, '', common.mustNotCall()),
+ {
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError
+ }
+ );
+ common.expectsError(
+ () => fs.link('', i, common.mustNotCall()),
+ {
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError
+ }
+ );
+ common.expectsError(
+ () => fs.linkSync(i, ''),
+ {
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError
+ }
+ );
+ common.expectsError(
+ () => fs.linkSync('', i),
+ {
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError
+ }
+ );
+});