Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gene Hallman
committed
Mar 12, 2013
1 parent
1261aed
commit cfea35b
Showing
6 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
var ar = require('../lib/ar'); | ||
var should = require('should'); | ||
|
||
module.exports = { | ||
|
||
'test .extractFile() when packed file exists': function(done) { | ||
var fileContents = ar.extractFile("tests/fixtures/test.ar", "test_file.txt"); | ||
fileContents.constructor.should.equal(Buffer); | ||
fileContents.toString().should.equal('this is a test\n'); | ||
done(); | ||
}, | ||
|
||
'test .extractFile() when packed file doesnt exist': function(done) { | ||
var fileContents = ar.extractFile("tests/fixtures/test.ar", "test_file2.txt"); | ||
fileContents.constructor.should.equal(Object); | ||
fileContents.status.should.equal('error'); | ||
fileContents.message.should.equal('Packed file not found'); | ||
done(); | ||
}, | ||
|
||
'test .extractFile() when archive file doesnt exist': function(done) { | ||
(function(){ | ||
ar.extractFile("nonexistant.ar", "test_file2.txt"); | ||
}).should.throw() | ||
done(); | ||
}, | ||
|
||
'test .extractFile() when archive file is broken': function(done) { | ||
var fileContents = ar.extractFile("tests/fixtures/broken.ar", "test_file.txt"); | ||
fileContents.constructor.should.equal(Object); | ||
fileContents.status.should.equal('error'); | ||
fileContents.message.should.equal('Missing file header'); | ||
done(); | ||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is not a very good archive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
!<arch> | ||
test_file.txt 1363128337 501 20 100644 15 ` | ||
this is a test | ||
|