Skip to content

Commit 9100cac

Browse files
Trottjasnell
authored andcommitted
test: simplify assert usage in test-stream2-basic
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 cd70a52 commit 9100cac

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

test/pummel/test-stream2-basic.js

+17-20
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ function run() {
107107
const fn = next[1];
108108
console.log('# %s', name);
109109
fn({
110-
same: assert.deepStrictEqual,
111-
ok: assert,
112-
equal: assert.strictEqual,
113110
end: function() {
114111
count--;
115112
run();
@@ -147,7 +144,7 @@ test('a most basic test', function(t) {
147144
'xxxxxxxxxxxxxxxxxxxxx' ];
148145

149146
r.on('end', function() {
150-
assert.strict(reads, expect);
147+
assert.deepStrictEqual(reads, expect);
151148
t.end();
152149
});
153150

@@ -180,7 +177,7 @@ test('pipe', function(t) {
180177
const w = new TestWriter();
181178

182179
w.on('end', function(received) {
183-
assert.strict(received, expect);
180+
assert.deepStrictEqual(received, expect);
184181
t.end();
185182
});
186183

@@ -211,10 +208,10 @@ test('pipe', function(t) {
211208
w[0].on('write', function() {
212209
if (--writes === 0) {
213210
r.unpipe();
214-
t.equal(r._readableState.pipes, null);
211+
assert.strictEqual(r._readableState.pipes, null);
215212
w[0].end();
216213
r.pipe(w[1]);
217-
t.equal(r._readableState.pipes, w[1]);
214+
assert.strictEqual(r._readableState.pipes, w[1]);
218215
}
219216
});
220217

@@ -223,18 +220,18 @@ test('pipe', function(t) {
223220
let ended0 = false;
224221
let ended1 = false;
225222
w[0].on('end', function(results) {
226-
t.equal(ended0, false);
223+
assert.strictEqual(ended0, false);
227224
ended0 = true;
228225
ended++;
229-
assert.strict(results, expect[0]);
226+
assert.deepStrictEqual(results, expect[0]);
230227
});
231228

232229
w[1].on('end', function(results) {
233-
t.equal(ended1, false);
230+
assert.strictEqual(ended1, false);
234231
ended1 = true;
235232
ended++;
236-
t.equal(ended, 2);
237-
assert.strict(results, expect[1]);
233+
assert.strictEqual(ended, 2);
234+
assert.deepStrictEqual(results, expect[1]);
238235
t.end();
239236
});
240237

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

262259
let c = 2;
263260
w[0].on('end', function(received) {
264-
assert.strict(received, expect, 'first');
261+
assert.deepStrictEqual(received, expect, 'first');
265262
if (--c === 0) t.end();
266263
});
267264
w[1].on('end', function(received) {
268-
assert.strict(received, expect, 'second');
265+
assert.deepStrictEqual(received, expect, 'second');
269266
if (--c === 0) t.end();
270267
});
271268

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

307304
w[0].on('end', function(results) {
308305
ended++;
309-
assert.strict(results, expect[0]);
306+
assert.deepStrictEqual(results, expect[0]);
310307
});
311308

312309
w[1].on('end', function(results) {
313310
ended++;
314-
t.equal(ended, 2);
315-
assert.strict(results, expect[1]);
311+
assert.strictEqual(ended, 2);
312+
assert.deepStrictEqual(results, expect[1]);
316313
t.end();
317314
});
318315

@@ -463,8 +460,8 @@ test('adding readable triggers data flow', function(t) {
463460
});
464461

465462
r.on('end', function() {
466-
t.equal(readCalled, 3);
467-
t.ok(onReadable);
463+
assert.strictEqual(readCalled, 3);
464+
assert.ok(onReadable);
468465
t.end();
469466
});
470467
});
@@ -473,6 +470,6 @@ test('chainable', function(t) {
473470
const r = new R();
474471
r._read = common.mustCall();
475472
const r2 = r.setEncoding('utf8').pause().resume().pause();
476-
t.equal(r, r2);
473+
assert.strictEqual(r, r2);
477474
t.end();
478475
});

0 commit comments

Comments
 (0)