summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-write.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-fs-write.js')
-rw-r--r--test/parallel/test-fs-write.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/parallel/test-fs-write.js b/test/parallel/test-fs-write.js
index ccf2d9b40f..cd52a57c36 100644
--- a/test/parallel/test-fs-write.js
+++ b/test/parallel/test-fs-write.js
@@ -86,3 +86,20 @@ fs.open(fn3, 'w', 0o644, common.mustCall(function(err, fd) {
fs.write(fd, expected, done);
}));
+
+[false, 'test', {}, [], null, undefined].forEach((i) => {
+ common.expectsError(
+ () => fs.write(i, common.mustNotCall()),
+ {
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError
+ }
+ );
+ common.expectsError(
+ () => fs.writeSync(i),
+ {
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError
+ }
+ );
+});