Skip to content

Commit cd70a52

Browse files
Trottjasnell
authored andcommitted
test: check noop function invocations
In test/pummel/test-stream2-basic.js, check that noop functions are called the expected number of times. PR-URL: #13146 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent db90b50 commit cd70a52

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

‎test/pummel/test-stream2-basic.js‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ test('a most basic test', function(t){
147147
'xxxxxxxxxxxxxxxxxxxxx'];
148148

149149
r.on('end',function(){
150-
t.same(reads,expect);
150+
assert.strict(reads,expect);
151151
t.end();
152152
});
153153

@@ -180,7 +180,7 @@ test('pipe', function(t){
180180
constw=newTestWriter();
181181

182182
w.on('end',function(received){
183-
t.same(received,expect);
183+
assert.strict(received,expect);
184184
t.end();
185185
});
186186

@@ -226,15 +226,15 @@ test('pipe', function(t){
226226
t.equal(ended0,false);
227227
ended0=true;
228228
ended++;
229-
t.same(results,expect[0]);
229+
assert.strict(results,expect[0]);
230230
});
231231

232232
w[1].on('end',function(results){
233233
t.equal(ended1,false);
234234
ended1=true;
235235
ended++;
236236
t.equal(ended,2);
237-
t.same(results,expect[1]);
237+
assert.strict(results,expect[1]);
238238
t.end();
239239
});
240240

@@ -261,11 +261,11 @@ test('multipipe', function(t){
261261

262262
letc=2;
263263
w[0].on('end',function(received){
264-
t.same(received,expect,'first');
264+
assert.strict(received,expect,'first');
265265
if(--c===0)t.end();
266266
});
267267
w[1].on('end',function(received){
268-
t.same(received,expect,'second');
268+
assert.strict(received,expect,'second');
269269
if(--c===0)t.end();
270270
});
271271

@@ -306,13 +306,13 @@ test('multipipe', function(t){
306306

307307
w[0].on('end',function(results){
308308
ended++;
309-
t.same(results,expect[0]);
309+
assert.strict(results,expect[0]);
310310
});
311311

312312
w[1].on('end',function(results){
313313
ended++;
314314
t.equal(ended,2);
315-
t.same(results,expect[1]);
315+
assert.strict(results,expect[1]);
316316
t.end();
317317
});
318318

@@ -323,7 +323,7 @@ test('multipipe', function(t){
323323

324324
test('back pressure respected',function(t){
325325
constr=newR({objectMode: true});
326-
r._read=common.noop;
326+
r._read=common.mustNotCall();
327327
letcounter=0;
328328
r.push(['one']);
329329
r.push(['two']);
@@ -341,7 +341,7 @@ test('back pressure respected', function(t){
341341
r.pipe(w3);
342342
});
343343
};
344-
w1.end=common.noop;
344+
w1.end=common.mustNotCall();
345345

346346
r.pipe(w1);
347347

@@ -367,7 +367,7 @@ test('back pressure respected', function(t){
367367

368368
returnfalse;
369369
};
370-
w2.end=common.noop;
370+
w2.end=common.mustCall();
371371

372372
constw3=newR();
373373
w3.write=function(chunk){
@@ -400,7 +400,7 @@ test('read(0) for ended streams', function(t){
400400
constr=newR();
401401
letwritten=false;
402402
letended=false;
403-
r._read=common.noop;
403+
r._read=common.mustNotCall();
404404

405405
r.push(Buffer.from('foo'));
406406
r.push(null);
@@ -471,7 +471,7 @@ test('adding readable triggers data flow', function(t){
471471

472472
test('chainable',function(t){
473473
constr=newR();
474-
r._read=common.noop;
474+
r._read=common.mustCall();
475475
constr2=r.setEncoding('utf8').pause().resume().pause();
476476
t.equal(r,r2);
477477
t.end();

0 commit comments

Comments
(0)