diff --git a/test/extract.js b/test/extract.js index 268579d..c1e4fd3 100644 --- a/test/extract.js +++ b/test/extract.js @@ -404,4 +404,17 @@ test('name-is-100', function(t) { }); extract.end(fs.readFileSync(fixtures.NAME_IS_100_TAR)); +}); + +test('invalid-file', function(t) { + t.plan(1); + + var extract = tar.extract(); + + extract.on('error', function(err) { + t.ok(!!err); + extract.destroy(); + }); + + extract.end(fs.readFileSync(fixtures.INVALID_TGZ)); }); \ No newline at end of file diff --git a/test/fixtures/index.js b/test/fixtures/index.js index 034259b..59bc87b 100644 --- a/test/fixtures/index.js +++ b/test/fixtures/index.js @@ -6,4 +6,5 @@ exports.TYPES_TAR = path.join(__dirname, 'types.tar'); exports.LONG_NAME_TAR = path.join(__dirname, 'long-name.tar'); exports.UNICODE_BSD_TAR = path.join(__dirname, 'unicode-bsd.tar'); exports.UNICODE_TAR = path.join(__dirname, 'unicode.tar'); -exports.NAME_IS_100_TAR = path.join(__dirname, 'name-is-100.tar'); \ No newline at end of file +exports.NAME_IS_100_TAR = path.join(__dirname, 'name-is-100.tar'); +exports.INVALID_TGZ = path.join(__dirname, 'invalid.tgz'); \ No newline at end of file diff --git a/test/fixtures/invalid.tgz b/test/fixtures/invalid.tgz new file mode 100644 index 0000000..ea35ec4 Binary files /dev/null and b/test/fixtures/invalid.tgz differ