summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRobert Nagy <ronagy@icloud.com>2021-01-06 21:35:01 +0100
committerRobert Nagy <ronagy@icloud.com>2021-07-14 12:01:41 +0200
commit83060510015c2ad05b156af54938d05e9b2df5ae (patch)
treec01cce436849d184e398171fd4db85a7d4deeaec /test
parent4a9fcb3534cc33f5fd3dc6f4dab4827411bba8f4 (diff)
downloadnode-new-83060510015c2ad05b156af54938d05e9b2df5ae.tar.gz
stream: add readableDidRead
Adds readableDidRead to streams and applies usage to http, http2 and quic. PR-URL: https://github.com/nodejs/node/pull/36820 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-stream-readable-didRead.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/parallel/test-stream-readable-didRead.js b/test/parallel/test-stream-readable-didRead.js
new file mode 100644
index 0000000000..18e2da97e8
--- /dev/null
+++ b/test/parallel/test-stream-readable-didRead.js
@@ -0,0 +1,24 @@
+'use strict';
+require('../common');
+const assert = require('assert');
+const Readable = require('stream').Readable;
+
+{
+ const readable = new Readable({
+ read: () => {}
+ });
+
+ assert.strictEqual(readable.readableDidRead, false);
+ readable.read();
+ assert.strictEqual(readable.readableDidRead, true);
+}
+
+{
+ const readable = new Readable({
+ read: () => {}
+ });
+
+ assert.strictEqual(readable.readableDidRead, false);
+ readable.resume();
+ assert.strictEqual(readable.readableDidRead, true);
+}