Merge pull request #4711 from atom/realpath-asar-unpacked-specs

Add specs for realpath of unpacked asar path
This commit is contained in:
Kevin Sawicki 2016-03-07 16:10:50 -08:00
commit 7b881ebc23

View file

@ -317,6 +317,13 @@ describe('asar package', function() {
assert.equal(r, path.join(parent, 'a.asar', 'dir1')); assert.equal(r, path.join(parent, 'a.asar', 'dir1'));
}); });
it('returns real path of an unpacked file', function() {
var parent = fs.realpathSync(path.join(fixtures, 'asar'));
var p = path.join('unpack.asar', 'a.txt');
var r = fs.realpathSync(path.join(parent, p));
assert.equal(r, path.join(parent, p));
});
it('throws ENOENT error when can not find file', function() { it('throws ENOENT error when can not find file', function() {
var parent = fs.realpathSync(path.join(fixtures, 'asar')); var parent = fs.realpathSync(path.join(fixtures, 'asar'));
var p = path.join('a.asar', 'not-exist'); var p = path.join('a.asar', 'not-exist');
@ -377,6 +384,17 @@ describe('asar package', function() {
done(); done();
}); });
}); });
it('returns real path of an unpacked file', function(done) {
var parent = fs.realpathSync(path.join(fixtures, 'asar'));
var p = path.join('unpack.asar', 'a.txt');
fs.realpath(path.join(parent, p), function(err, r) {
assert.equal(err, null);
assert.equal(r, path.join(parent, p));
done();
});
});
it('throws ENOENT error when can not find file', function(done) { it('throws ENOENT error when can not find file', function(done) {
var parent = fs.realpathSync(path.join(fixtures, 'asar')); var parent = fs.realpathSync(path.join(fixtures, 'asar'));
var p = path.join('a.asar', 'not-exist'); var p = path.join('a.asar', 'not-exist');