Skip to content

Commit 1f16758

Browse files
Masashi Hiranoaddaleax
Masashi Hirano
authored andcommitted
test: check option start or end is not safe integer
To increase fs readstream coverage, added test to check error when option.start or end is not safe integer. PR-URL: #21704 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Claudio Rodriguez <[email protected]> Reviewed-By: Weijia Wang <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 3898abc commit 1f16758

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: test/parallel/test-fs-read-stream-throw-type-error.js

+9
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,12 @@ fs.createReadStream(example, { start: 1, end: 5 });
6565

6666
// Case 6: Should throw RangeError if start is greater than end
6767
createReadStreamErr(example, { start: 5, end: 1 }, rangeError);
68+
69+
// Case 7: Should throw RangeError if start or end is not safe integer
70+
const NOT_SAFE_INTEGER = 2 ** 53;
71+
[
72+
{ start: NOT_SAFE_INTEGER, end: Infinity },
73+
{ start: 0, end: NOT_SAFE_INTEGER }
74+
].forEach((opts) =>
75+
createReadStreamErr(example, opts, rangeError)
76+
);

0 commit comments

Comments
 (0)