From f3b9a8334364c86a43ff34e998cf87b8ca4a3f65 Mon Sep 17 00:00:00 2001 From: Abir Viqar Date: Sat, 23 Nov 2013 13:35:14 -0500 Subject: [PATCH] test link should not follow symbolic links --- tests/spec/idbfs.spec.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/spec/idbfs.spec.js b/tests/spec/idbfs.spec.js index ff55dc5..887d154 100644 --- a/tests/spec/idbfs.spec.js +++ b/tests/spec/idbfs.spec.js @@ -1258,7 +1258,45 @@ describe('fs.link', function() { 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() { beforeEach(function() {