From aea97862edf20d8c92c0f0cc35f27a155eb913cf Mon Sep 17 00:00:00 2001 From: Masashi Hirano Date: Sun, 8 Jul 2018 08:13:38 +0900 Subject: [PATCH] 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. --- test/parallel/test-fs-read-stream-throw-type-error.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/parallel/test-fs-read-stream-throw-type-error.js b/test/parallel/test-fs-read-stream-throw-type-error.js index 9886b3c9a46d97..458df4d347efc4 100644 --- a/test/parallel/test-fs-read-stream-throw-type-error.js +++ b/test/parallel/test-fs-read-stream-throw-type-error.js @@ -65,3 +65,12 @@ fs.createReadStream(example, { start: 1, end: 5 }); // Case 6: Should throw RangeError if start is greater than end createReadStreamErr(example, { start: 5, end: 1 }, rangeError); + +// Case 7: Should throw RangeError if start or end is not safe integer +const NOT_SAFE_INTEGER = 2 ** 53; +[ + { start: NOT_SAFE_INTEGER, end: Infinity }, + { start: 0, end: NOT_SAFE_INTEGER } +].forEach((opts) => + createReadStreamErr(example, opts, rangeError) +);