summaryrefslogtreecommitdiffstats
path: root/test/readable.test.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/readable.test.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/readable.test.js b/test/readable.test.js
new file mode 100644
index 0000000..3f4f793
--- /dev/null
+++ b/test/readable.test.js
@@ -0,0 +1,23 @@
+'use strict'
+
+const { test } = require('tap')
+const Readable = require('../lib/api/readable')
+
+test('avoid body reordering', async function (t) {
+ function resume () {
+ }
+ function abort () {
+ }
+ const r = new Readable({ resume, abort })
+
+ r.push(Buffer.from('hello'))
+
+ process.nextTick(() => {
+ r.push(Buffer.from('world'))
+ r.push(null)
+ })
+
+ const text = await r.text()
+
+ t.equal(text, 'helloworld')
+})