Skip to content

Commit

Permalink
test: improve test coverage for fs module
Browse files Browse the repository at this point in the history
Covering the case when fs-read get invalid argument for file handle

PR-URL: #23601
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
  • Loading branch information
leomoreno authored and addaleax committed Oct 20, 2018
1 parent 9de80e6 commit 3f63297
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/parallel/test-fs-read.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
);

0 comments on commit 3f63297

Please sign in to comment.