Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: check noop function invocations
In test/pummel/test-stream2-basic.js, check that noop functions are
called the expected number of times.
  • Loading branch information
Trott committed May 21, 2017
commit 4dc7862d5913d538093f15a1f077b464a8e19ed0
26 changes: 13 additions & 13 deletions test/pummel/test-stream2-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ test('a most basic test', function(t) {
'xxxxxxxxxxxxxxxxxxxxx' ];

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

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

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

Expand Down Expand Up @@ -226,15 +226,15 @@ test('pipe', function(t) {
t.equal(ended0, false);
ended0 = true;
ended++;
t.same(results, expect[0]);
assert.strict(results, expect[0]);
});

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

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

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

Expand Down Expand Up @@ -306,13 +306,13 @@ test('multipipe', function(t) {

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

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

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

test('back pressure respected', function(t) {
const r = new R({ objectMode: true });
r._read = common.noop;
r._read = common.mustNotCall();
let counter = 0;
r.push(['one']);
r.push(['two']);
Expand All @@ -341,7 +341,7 @@ test('back pressure respected', function(t) {
r.pipe(w3);
});
};
w1.end = common.noop;
w1.end = common.mustNotCall();

r.pipe(w1);

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

return false;
};
w2.end = common.noop;
w2.end = common.mustCall();

const w3 = new R();
w3.write = function(chunk) {
Expand Down Expand Up @@ -400,7 +400,7 @@ test('read(0) for ended streams', function(t) {
const r = new R();
let written = false;
let ended = false;
r._read = common.noop;
r._read = common.mustNotCall();

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

test('chainable', function(t) {
const r = new R();
r._read = common.noop;
r._read = common.mustCall();
const r2 = r.setEncoding('utf8').pause().resume().pause();
t.equal(r, r2);
t.end();
Expand Down