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