From 635dd2e89906902ea58b9bb6fbe45315159c8502 Mon Sep 17 00:00:00 2001 From: Abir Viqar Date: Sat, 23 Nov 2013 13:35:05 -0500 Subject: [PATCH] test readdir's symbolic link support --- tests/spec/idbfs.spec.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/spec/idbfs.spec.js b/tests/spec/idbfs.spec.js index f53ca02..aac1838 100644 --- a/tests/spec/idbfs.spec.js +++ b/tests/spec/idbfs.spec.js @@ -468,6 +468,35 @@ describe('fs.readdir', function() { expect(_files[0]).toEqual('tmp'); }); }); + + it('should follow symbolic links', function() { + var complete = false; + var _error, _files; + var that = this; + + that.fs.mkdir('/tmp', function(error) { + if(error) throw error; + that.fs.symlink('/', '/tmp/dirLink', function(error) { + if(error) throw error; + that.fs.readdir('/tmp/dirLink', function(error, result) { + _error = error; + _files = result; + + complete = true; + }); + }); + }); + + waitsFor(function() { + return complete; + }, 'test to complete', DEFAULT_TIMEOUT); + + runs(function() { + expect(_error).not.toBeDefined(); + expect(_files.length).toEqual(1); + expect(_files[0]).toEqual('tmp'); + }); + }); }); describe('fs.rmdir', function() {