Skip to content

Commit e15e2e7

Browse files
TrottMylesBorins
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 <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 4a3e089 commit e15e2e7

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

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

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

127127
r.on('end',function(){
128-
t.same(reads,expect);
128+
assert.deepStrictEqual(reads,expect);
129129
t.end();
130130
});
131131

@@ -158,7 +158,7 @@ test('pipe', function(t) {
158158
constw=newTestWriter();
159159

160160
w.on('end',function(received){
161-
t.same(received,expect);
161+
assert.deepStrictEqual(received,expect);
162162
t.end();
163163
});
164164

@@ -204,15 +204,15 @@ test('pipe', function(t) {
204204
t.equal(ended0,false);
205205
ended0=true;
206206
ended++;
207-
t.same(results,expect[0]);
207+
assert.deepStrictEqual(results,expect[0]);
208208
});
209209

210210
w[1].on('end',function(results){
211211
t.equal(ended1,false);
212212
ended1=true;
213213
ended++;
214214
t.equal(ended,2);
215-
t.same(results,expect[1]);
215+
assert.deepStrictEqual(results,expect[1]);
216216
t.end();
217217
});
218218

@@ -239,11 +239,11 @@ test('multipipe', function(t) {
239239

240240
letc=2;
241241
w[0].on('end',function(received){
242-
t.same(received,expect,'first');
242+
assert.deepStrictEqual(received,expect,'first');
243243
if(--c===0)t.end();
244244
});
245245
w[1].on('end',function(received){
246-
t.same(received,expect,'second');
246+
assert.deepStrictEqual(received,expect,'second');
247247
if(--c===0)t.end();
248248
});
249249

@@ -284,13 +284,13 @@ test('multipipe', function(t) {
284284

285285
w[0].on('end',function(results){
286286
ended++;
287-
t.same(results,expect[0]);
287+
assert.deepStrictEqual(results,expect[0]);
288288
});
289289

290290
w[1].on('end',function(results){
291291
ended++;
292292
t.equal(ended,2);
293-
t.same(results,expect[1]);
293+
assert.deepStrictEqual(results,expect[1]);
294294
t.end();
295295
});
296296

@@ -300,10 +300,8 @@ test('multipipe', function(t) {
300300
});
301301

302302
test('back pressure respected',function(t){
303-
functionnoop(){}
304-
305303
constr=newR({objectMode: true});
306-
r._read=noop;
304+
r._read=common.mustNotCall();
307305
letcounter=0;
308306
r.push(['one']);
309307
r.push(['two']);
@@ -321,7 +319,7 @@ test('back pressure respected', function(t) {
321319
r.pipe(w3);
322320
});
323321
};
324-
w1.end=noop;
322+
w1.end=common.mustNotCall();
325323

326324
r.pipe(w1);
327325

@@ -347,7 +345,7 @@ test('back pressure respected', function(t) {
347345

348346
returnfalse;
349347
};
350-
w2.end=noop;
348+
w2.end=common.mustCall();
351349

352350
letw3=newR();
353351
w3.write=function(chunk){
@@ -380,7 +378,7 @@ test('read(0) for ended streams', function(t) {
380378
constr=newR();
381379
letwritten=false;
382380
letended=false;
383-
r._read=function(n){};
381+
r._read=common.mustNotCall();
384382

385383
r.push(Buffer.from('foo'));
386384
r.push(null);
@@ -451,7 +449,7 @@ test('adding readable triggers data flow', function(t) {
451449

452450
test('chainable',function(t){
453451
constr=newR();
454-
r._read=common.noop;
452+
r._read=common.mustCall();
455453
constr2=r.setEncoding('utf8').pause().resume().pause();
456454
t.equal(r,r2);
457455
t.end();

0 commit comments

Comments
 (0)