Example #1
0
File: Pz.js Project: rixo/pz-stream
 ['a', 'b', 'c'].forEach(alpha => {
   const input = new Stream.PassThrough({objectMode: true});
   [1, 2, 3].forEach(num => {
     input.push({alpha: alpha, num: num, id: alpha + num});
   });
   input.pipe(pz);
   input.push(null);
 });
  it("should end correctly when piped through with no streams and no data written", function(done) {
    var input = new stream.PassThrough({objectMode: true});
    var nowhere = new stream.Writable({objectMode: true});
    nowhere._write = function _write(input, encoding, done) { return done(); };

    var stack = bun([]);

    stack.on("end", function() {
      done();
    });

    input.pipe(stack).pipe(nowhere);
    input.push(null);
  });
  it("should end when wrapped streams end", function(done) {
    var alice = new stream.PassThrough({objectMode: true});
    var nowhere = new stream.Writable({objectMode: true});
    nowhere._write = function _write(input, encoding, done) { return done(); };

    var stack = bun([alice]);

    stack.on("end", function() {
      done();
    });

    stack.pipe(nowhere);

    alice.push(null);
  });
Example #4
0
    beforeEach(function() {
      counter = Counter();
      input = new Stream.PassThrough({objectMode: true});

      inputs = [1, 2, 3].map(function(id) {
        var o = {id: id};
        input.push(o);
        return o;
      });

      input.push(null);

      stream = input
        .pipe(new TestedStream({objectMode: true}))
        .pipe(counter);
    });
Example #5
0
 inputs = [1, 2, 3].map(function(id) {
   var o = {id: id};
   input.push(o);
   return o;
 });
Example #6
0
File: Pz.js Project: rixo/pz-stream
 [1, 2, 3].forEach(num => {
   input.push({alpha: alpha, num: num, id: alpha + num});
 });