test.js 640 B

1234567891011121314151617181920212223242526
  1. var source = require('vinyl-source-stream')
  2. var buffer = require('./')
  3. var test = require('tape')
  4. var fs = require('fs')
  5. test('converted', function(t) {
  6. t.plan(2)
  7. fs.createReadStream(__filename)
  8. .pipe(source('bundle.js'))
  9. .pipe(buffer())
  10. .once('data', function(file) {
  11. t.ok(!file.isStream(), 'is not a stream')
  12. t.ok( file.isBuffer(), 'is a buffer')
  13. })
  14. })
  15. test('not converted', function(t) {
  16. t.plan(2)
  17. fs.createReadStream(__filename)
  18. .pipe(source('bundle.js'))
  19. .once('data', function(file) {
  20. t.ok( file.isStream(), 'is a stream')
  21. t.ok(!file.isBuffer(), 'is not a buffer')
  22. })
  23. })