0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
nodejs/test/parallel/test-stream-transform-objectmode-falsey-value.js
Rich Trott a7335bd1f0 test,benchmark: use deepStrictEqual()
In preparation for a lint rule that will enforce
assert.deepStrictEqual() over assert.deepEqual(), change tests and
benchmarks accordingly. For tests and benchmarks that are testing or
benchmarking assert.deepEqual() itself, apply a comment to ignore the
upcoming rule.

PR-URL: https://github.com/nodejs/node/pull/6213
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-22 14:38:09 -07:00

34 lines
683 B
JavaScript

'use strict';
require('../common');
var assert = require('assert');
var stream = require('stream');
var PassThrough = stream.PassThrough;
var src = new PassThrough({ objectMode: true });
var tx = new PassThrough({ objectMode: true });
var dest = new PassThrough({ objectMode: true });
var expect = [ -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
var results = [];
process.on('exit', function() {
assert.deepStrictEqual(results, expect);
console.log('ok');
});
dest.on('data', function(x) {
results.push(x);
});
src.pipe(tx).pipe(dest);
var i = -1;
var int = setInterval(function() {
if (i > 10) {
src.end();
clearInterval(int);
} else {
src.write(i++);
}
});