Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pipe_test.js 1018B

123456789101112131415161718192021222324252627282930313233343536
  1. var stream = require('../lib/lazystream');
  2. var helper = require('./helper');
  3. exports.pipe = {
  4. readwrite: function(test) {
  5. var expected = [ 'line1\n', 'line2\n' ];
  6. var actual = [];
  7. var readableInstantiated = false;
  8. var writableInstantiated = false;
  9. test.expect(3);
  10. var readable = new stream.Readable(function() {
  11. readableInstantiated = true;
  12. return new helper.DummyReadable([].concat(expected));
  13. });
  14. var writable = new stream.Writable(function() {
  15. writableInstantiated = true;
  16. return new helper.DummyWritable(actual);
  17. });
  18. test.equal(readableInstantiated, false, 'DummyReadable should only be instantiated when it is needed');
  19. test.equal(writableInstantiated, false, 'DummyWritable should only be instantiated when it is needed');
  20. writable.on('end', function() {
  21. test.equal(actual.join(''), expected.join(''), 'Piping on demand streams should keep data intact');
  22. test.done();
  23. });
  24. readable.pipe(writable);
  25. }
  26. };