Skip to content
Permalink
Browse files

test: simplify assert usage in test-stream2-basic

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>
  • Loading branch information...
Trott authored and jasnell committed May 21, 2017
1 parent cd70a52 commit 9100cac146761edbf8d8a8aefae422cdfc2b5c2b
Showing with 17 additions and 20 deletions.
  1. +17 −20 test/pummel/test-stream2-basic.js
@@ -107,9 +107,6 @@ function run() {
const fn = next[1]; const fn = next[1];
console.log('# %s', name); console.log('# %s', name);
fn({ fn({
same: assert.deepStrictEqual,
ok: assert,
equal: assert.strictEqual,
end: function() { end: function() {
count--; count--;
run(); run();
@@ -147,7 +144,7 @@ test('a most basic test', function(t) {
'xxxxxxxxxxxxxxxxxxxxx' ]; 'xxxxxxxxxxxxxxxxxxxxx' ];


r.on('end', function() { r.on('end', function() {
assert.strict(reads, expect); assert.deepStrictEqual(reads, expect);
t.end(); t.end();
}); });


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


w.on('end', function(received) { w.on('end', function(received) {
assert.strict(received, expect); assert.deepStrictEqual(received, expect);
t.end(); t.end();
}); });


@@ -211,10 +208,10 @@ test('pipe', function(t) {
w[0].on('write', function() { w[0].on('write', function() {
if (--writes === 0) { if (--writes === 0) {
r.unpipe(); r.unpipe();
t.equal(r._readableState.pipes, null); assert.strictEqual(r._readableState.pipes, null);
w[0].end(); w[0].end();
r.pipe(w[1]); r.pipe(w[1]);
t.equal(r._readableState.pipes, w[1]); assert.strictEqual(r._readableState.pipes, w[1]);
} }
}); });


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


w[1].on('end', function(results) { w[1].on('end', function(results) {
t.equal(ended1, false); assert.strictEqual(ended1, false);
ended1 = true; ended1 = true;
ended++; ended++;
t.equal(ended, 2); assert.strictEqual(ended, 2);
assert.strict(results, expect[1]); assert.deepStrictEqual(results, expect[1]);
t.end(); t.end();
}); });


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


let c = 2; let c = 2;
w[0].on('end', function(received) { w[0].on('end', function(received) {
assert.strict(received, expect, 'first'); assert.deepStrictEqual(received, expect, 'first');
if (--c === 0) t.end(); if (--c === 0) t.end();
}); });
w[1].on('end', function(received) { w[1].on('end', function(received) {
assert.strict(received, expect, 'second'); assert.deepStrictEqual(received, expect, 'second');
if (--c === 0) t.end(); if (--c === 0) t.end();
}); });


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


w[0].on('end', function(results) { w[0].on('end', function(results) {
ended++; ended++;
assert.strict(results, expect[0]); assert.deepStrictEqual(results, expect[0]);
}); });


w[1].on('end', function(results) { w[1].on('end', function(results) {
ended++; ended++;
t.equal(ended, 2); assert.strictEqual(ended, 2);
assert.strict(results, expect[1]); assert.deepStrictEqual(results, expect[1]);
t.end(); t.end();
}); });


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


r.on('end', function() { r.on('end', function() {
t.equal(readCalled, 3); assert.strictEqual(readCalled, 3);
t.ok(onReadable); assert.ok(onReadable);
t.end(); t.end();
}); });
}); });
@@ -473,6 +470,6 @@ test('chainable', function(t) {
const r = new R(); const r = new R();
r._read = common.mustCall(); r._read = common.mustCall();
const r2 = r.setEncoding('utf8').pause().resume().pause(); const r2 = r.setEncoding('utf8').pause().resume().pause();
t.equal(r, r2); assert.strictEqual(r, r2);
t.end(); t.end();
}); });

0 comments on commit 9100cac

Please sign in to comment.
You can’t perform that action at this time.