summaryrefslogtreecommitdiff
path: root/test/parallel/test-stream2-objects.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-stream2-objects.js')
-rw-r--r--test/parallel/test-stream2-objects.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/test/parallel/test-stream2-objects.js b/test/parallel/test-stream2-objects.js
index 7b775fe1c3..159286a432 100644
--- a/test/parallel/test-stream2-objects.js
+++ b/test/parallel/test-stream2-objects.js
@@ -20,7 +20,8 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
-require('../common');
+
+const common = require('../common');
const Readable = require('_stream_readable');
const Writable = require('_stream_writable');
const assert = require('assert');
@@ -75,7 +76,7 @@ function toArray(callback) {
function fromArray(list) {
const r = new Readable({ objectMode: true });
- r._read = noop;
+ r._read = common.noop;
list.forEach(function(chunk) {
r.push(chunk);
});
@@ -84,8 +85,6 @@ function fromArray(list) {
return r;
}
-function noop() {}
-
test('can read objects from stream', function(t) {
const r = fromArray([{ one: '1'}, { two: '2' }]);
@@ -165,7 +164,7 @@ test('can read strings as objects', function(t) {
const r = new Readable({
objectMode: true
});
- r._read = noop;
+ r._read = common.noop;
const list = ['one', 'two', 'three'];
list.forEach(function(str) {
r.push(str);
@@ -183,7 +182,7 @@ test('read(0) for object streams', function(t) {
const r = new Readable({
objectMode: true
});
- r._read = noop;
+ r._read = common.noop;
r.push('foobar');
r.push(null);
@@ -199,7 +198,7 @@ test('falsey values', function(t) {
const r = new Readable({
objectMode: true
});
- r._read = noop;
+ r._read = common.noop;
r.push(false);
r.push(0);
@@ -250,7 +249,7 @@ test('high watermark push', function(t) {
highWaterMark: 6,
objectMode: true
});
- r._read = function(n) {};
+ r._read = common.noop;
for (let i = 0; i < 6; i++) {
const bool = r.push(i);
assert.strictEqual(bool, i !== 5);