diff options
author | James M Snell <jasnell@gmail.com> | 2017-11-26 13:35:06 -0800 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-12-13 13:26:33 -0800 |
commit | 956f97b875c9d5193395c70b378c8e1bcedca08e (patch) | |
tree | c678fcb78d8c3ee321bef62a2d1a09e279fb821d /test/parallel/test-fs-fsync.js | |
parent | 639096855ed52958a5bf7ccc0a83cee6a4a24166 (diff) | |
download | android-node-v8-956f97b875c9d5193395c70b378c8e1bcedca08e.tar.gz android-node-v8-956f97b875c9d5193395c70b378c8e1bcedca08e.tar.bz2 android-node-v8-956f97b875c9d5193395c70b378c8e1bcedca08e.zip |
fs: move type checking for fs.fdatasync to js
PR-URL: https://github.com/nodejs/node/pull/17334
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-fsync.js')
-rw-r--r-- | test/parallel/test-fs-fsync.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/parallel/test-fs-fsync.js b/test/parallel/test-fs-fsync.js index 3f43dd7545..1a9d1d97f8 100644 --- a/test/parallel/test-fs-fsync.js +++ b/test/parallel/test-fs-fsync.js @@ -48,3 +48,41 @@ fs.open(fileFixture, 'a', 0o777, common.mustCall(function(err, fd) { })); })); })); + +['', false, null, undefined, {}, []].forEach((i) => { + common.expectsError( + () => fs.fdatasync(i), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "fd" argument must be of type number' + } + ); + common.expectsError( + () => fs.fdatasyncSync(i), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "fd" argument must be of type number' + } + ); +}); + +[-1, 0xFFFFFFFF + 1].forEach((i) => { + common.expectsError( + () => fs.fdatasync(i), + { + code: 'ERR_OUT_OF_RANGE', + type: RangeError, + message: 'The "fd" argument is out of range' + } + ); + common.expectsError( + () => fs.fdatasyncSync(i), + { + code: 'ERR_OUT_OF_RANGE', + type: RangeError, + message: 'The "fd" argument is out of range' + } + ); +}); |