3.js 673 B

123456789101112131415161718192021222324252627
  1. var test = require('tape')
  2. , streamify = require('..')
  3. ;
  4. test('ctor', function(t) {
  5. t.throws(function() {
  6. streamify();
  7. }, 'throws: no argument');
  8. [null, undefined, 1, NaN, 'string', new Object(), function(){}].forEach(
  9. function(item) {
  10. t.throws(function() {
  11. streamify(item);
  12. }, 'throws: ' + (!item? 'null/undefined' : item.toString()));
  13. }
  14. );
  15. [[], [1], [1,2], ['1', '2'], [new Buffer('asdf')]].forEach(
  16. function(item) {
  17. t.doesNotThrow(function() {
  18. streamify(item);
  19. }, 'accepts: ' + item.toString());
  20. }
  21. );
  22. t.end();
  23. });