summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-write-stream.js
diff options
context:
space:
mode:
authorRobert Nagy <ronagy@icloud.com>2019-08-08 11:18:39 +0200
committerRich Trott <rtrott@gmail.com>2019-09-22 16:23:02 -0700
commit95d6ad67bfc9ef3e2f4705c81c88e32c5b1cea51 (patch)
treef376f48d677cd9eb6b4806d7064844416dbaf8a6 /test/parallel/test-fs-write-stream.js
parenta861b84d5d260d580243741b8e2f1c2b7330a6a2 (diff)
downloadandroid-node-v8-95d6ad67bfc9ef3e2f4705c81c88e32c5b1cea51.tar.gz
android-node-v8-95d6ad67bfc9ef3e2f4705c81c88e32c5b1cea51.tar.bz2
android-node-v8-95d6ad67bfc9ef3e2f4705c81c88e32c5b1cea51.zip
fs: remove unnecessary argument check
Writable already assures that only Buffer's are passed to _write. Also this is not the "correct" way to handle errors inside _write. PR-URL: https://github.com/nodejs/node/pull/29043 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-write-stream.js')
-rw-r--r--test/parallel/test-fs-write-stream.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/parallel/test-fs-write-stream.js b/test/parallel/test-fs-write-stream.js
index 5e75f4a0b3..18374f44eb 100644
--- a/test/parallel/test-fs-write-stream.js
+++ b/test/parallel/test-fs-write-stream.js
@@ -56,12 +56,13 @@ tmpdir.refresh();
// Throws if data is not of type Buffer.
{
const stream = fs.createWriteStream(file);
- common.expectsError(() => {
- stream._write(42, null, function() {});
- }, {
+ stream.on('error', common.expectsError({
code: 'ERR_INVALID_ARG_TYPE',
- type: TypeError,
- message: 'The "data" argument must be of type Buffer. Received type number'
- });
+ type: TypeError
+ }));
+ stream.write(42, null, common.expectsError({
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError
+ }));
stream.destroy();
}