From 8e7a12f4500c702731313591d64726031ab8c4d2 Mon Sep 17 00:00:00 2001 From: "garrik.leonardo@gmail.com" Date: Fri, 12 Oct 2018 13:30:40 -0500 Subject: [PATCH] test: improve test coverage for fs module Covering the case when fs-read get invalid argument for file handle PR-URL: https://github.com/nodejs/node/pull/23601 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Trivikram Kamat Reviewed-By: Gireesh Punathil --- test/parallel/test-fs-read.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/parallel/test-fs-read.js b/test/parallel/test-fs-read.js index 864876537c22c6..715c7b6aebd98d 100644 --- a/test/parallel/test-fs-read.js +++ b/test/parallel/test-fs-read.js @@ -68,3 +68,11 @@ test(new Uint8Array(expected.length), assert.strictEqual(nRead, 0); })); } + +assert.throws( + () => fs.read(null, Buffer.alloc(1), 0, 1, 0), + { + message: 'The "fd" argument must be of type number. Received type object', + code: 'ERR_INVALID_ARG_TYPE', + } +);