Front end of the Slack clone application.

error-on-broken.js 768B

12345678910111213141516171819202122232425262728293031323334
  1. var fs = require('fs')
  2. var path = require('path')
  3. var zlib = require('zlib')
  4. var tap = require('tap')
  5. var tar = require('../tar.js')
  6. var file = path.join(__dirname, 'cb-never-called-1.0.1.tgz')
  7. var target = path.join(__dirname, 'tmp/extract-test')
  8. tap.test('preclean', function (t) {
  9. require('rimraf').sync(__dirname + '/tmp/extract-test')
  10. t.pass('cleaned!')
  11. t.end()
  12. })
  13. tap.test('extract test', function (t) {
  14. var extract = tar.Extract(target)
  15. var inp = fs.createReadStream(file)
  16. inp.pipe(zlib.createGunzip()).pipe(extract)
  17. extract.on('error', function (er) {
  18. t.equal(er.message, 'unexpected eof', 'error noticed')
  19. t.end()
  20. })
  21. extract.on('end', function () {
  22. t.fail('shouldn\'t reach this point due to errors')
  23. t.end()
  24. })
  25. })