Skip to content

Commit ec357bf

Browse files
Trottjasnell
authored andcommitted
test: use mustNotCall() in test-stream2-objects
Use `common.mustNotCall()` in test-stream2-objects.js to confirm that noop function is never invoked. PR-URL: #13249 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 5369359 commit ec357bf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/parallel/test-stream2-objects.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function toArray(callback) {
7676

7777
function fromArray(list) {
7878
const r = new Readable({ objectMode: true });
79-
r._read = common.noop;
79+
r._read = common.mustNotCall();
8080
list.forEach(function(chunk) {
8181
r.push(chunk);
8282
});
@@ -164,7 +164,7 @@ test('can read strings as objects', function(t) {
164164
const r = new Readable({
165165
objectMode: true
166166
});
167-
r._read = common.noop;
167+
r._read = common.mustNotCall();
168168
const list = ['one', 'two', 'three'];
169169
list.forEach(function(str) {
170170
r.push(str);
@@ -182,7 +182,7 @@ test('read(0) for object streams', function(t) {
182182
const r = new Readable({
183183
objectMode: true
184184
});
185-
r._read = common.noop;
185+
r._read = common.mustNotCall();
186186

187187
r.push('foobar');
188188
r.push(null);
@@ -198,7 +198,7 @@ test('falsey values', function(t) {
198198
const r = new Readable({
199199
objectMode: true
200200
});
201-
r._read = common.noop;
201+
r._read = common.mustNotCall();
202202

203203
r.push(false);
204204
r.push(0);
@@ -249,7 +249,7 @@ test('high watermark push', function(t) {
249249
highWaterMark: 6,
250250
objectMode: true
251251
});
252-
r._read = common.noop;
252+
r._read = common.mustNotCall();
253253
for (let i = 0; i < 6; i++) {
254254
const bool = r.push(i);
255255
assert.strictEqual(bool, i !== 5);

0 commit comments

Comments
 (0)