From 929e8df1c0838858f94ac8750a70be610be5d913 Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Sun, 16 May 2021 23:03:20 +0800 Subject: [PATCH] test: improve coverage of stream.Readable PR-URL: https://github.com/nodejs/node/pull/38702 Refs: https://coverage.nodejs.org/coverage-0996eb71edbd47d9/lib/internal/streams/readable.js.html#L401 Reviewed-By: Antoine du Hamel Reviewed-By: Rich Trott Reviewed-By: Daijiro Wachi Reviewed-By: Benjamin Gruenbaum Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Matteo Collina --- test/parallel/test-streams-highwatermark.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/parallel/test-streams-highwatermark.js b/test/parallel/test-streams-highwatermark.js index 7d13be2dd19077..18c53b1032e849 100644 --- a/test/parallel/test-streams-highwatermark.js +++ b/test/parallel/test-streams-highwatermark.js @@ -57,3 +57,16 @@ const { inspect } = require('util'); readable._read = common.mustCall(); readable.read(0); } + +{ + // Parse size as decimal integer + ['1', '1.0', 1].forEach((size) => { + const readable = new stream.Readable({ + read: common.mustCall(), + highWaterMark: 0, + }); + readable.read(size); + + assert.strictEqual(readable._readableState.highWaterMark, Number(size)); + }); +}