From c7ea45a18b9384b57854610dbc0d740aeb9aaee3 Mon Sep 17 00:00:00 2001 From: Ruihui Yan Date: Tue, 9 Oct 2018 14:31:15 -0400 Subject: [PATCH] Fix issue #475 - Add test for fs.exits() when resulting path of a symbolic link is not found (#519) * add test for exits when resulting path of a symbolic link is not found * fixed style nit --- tests/spec/fs.exists.spec.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/spec/fs.exists.spec.js b/tests/spec/fs.exists.spec.js index f883501..2d8d0ed 100644 --- a/tests/spec/fs.exists.spec.js +++ b/tests/spec/fs.exists.spec.js @@ -56,4 +56,29 @@ describe('fs.exists', function() { }); }); }); + + it('should follow symbolic links and return false if for the resulting path does not exist', function(done) { + var fs = util.fs(); + + fs.open('/myfile', 'w', function(error, fd) { + if(error) throw error; + + fs.close(fd, function(error) { + if(error) throw error; + + fs.symlink('/myfile', '/myfilelink', function(error) { + if(error) throw error; + + fs.unlink('/myfile', function(err) { + if(err) throw err; + + fs.exists('/myfilelink', function(result) { + expect(result).to.be.false; + done(); + }); + }); + }); + }); + }); + }); });