test link should not follow symbolic links

This commit is contained in:
Abir Viqar 2013-11-23 13:35:14 -05:00
parent 656dfd242b
commit f3b9a83343
1 changed files with 38 additions and 0 deletions

View File

@ -1258,7 +1258,45 @@ describe('fs.link', function() {
expect(_newstats).toEqual(_oldstats); expect(_newstats).toEqual(_oldstats);
}); });
}); });
it('should not follow symbolic links', function () {
var complete = false;
var _error, _oldstats, _linkstats, _newstats;
var that = this;
that.fs.stat('/', function (error, result) {
if (error) throw error;
_oldstats = result;
that.fs.symlink('/', '/myfileLink', function (error) {
if (error) throw error;
that.fs.link('/myfileLink', '/myotherfile', function (error) {
if (error) throw error;
that.fs.lstat('/myfileLink', function (error, result) {
if (error) throw error;
_linkstats = result;
that.fs.lstat('/myotherfile', function (error, result) {
if (error) throw error;
_newstats = result;
complete = true;
});
});
});
});
});
waitsFor(function () {
return complete;
}, 'test to complete', DEFAULT_TIMEOUT);
runs(function () {
expect(_error).not.toBeDefined();
expect(_newstats.node).toEqual(_linkstats.node);
expect(_newstats.node).toNotEqual(_oldstats.node);
expect(_newstats.nlinks).toEqual(2);
expect(_newstats).toEqual(_linkstats);
});
}); });
});
describe('fs.unlink', function() { describe('fs.unlink', function() {
beforeEach(function() { beforeEach(function() {