From 34434b05047ac4004979345521091261d688c35e Mon Sep 17 00:00:00 2001 From: Andrew Koung Date: Tue, 16 Apr 2019 23:31:26 -0400 Subject: [PATCH] made review changes for creating lstat test and property add on for interface.js --- src/filesystem/interface.js | 2 +- tests/spec/fs.chown.spec.js | 40 ++++++++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/filesystem/interface.js b/src/filesystem/interface.js index 93e491b..67f5016 100644 --- a/src/filesystem/interface.js +++ b/src/filesystem/interface.js @@ -340,7 +340,7 @@ function FileSystem(options, callback) { { name: 'ftruncate' }, { name: 'futimes' }, { name: 'getxattr', promises: true, absPathArgs: [0] }, - { name: 'lchown' }, + { name: 'lchown', promises:true }, { name: 'link', promises: true, absPathArgs: [0, 1] }, { name: 'lseek' }, { name: 'lstat', promises: true }, diff --git a/tests/spec/fs.chown.spec.js b/tests/spec/fs.chown.spec.js index 575f779..d9bfc73 100644 --- a/tests/spec/fs.chown.spec.js +++ b/tests/spec/fs.chown.spec.js @@ -135,18 +135,6 @@ describe('fs.chown, fs.fchown, fs.lchown', function() { fs.stat('/file', function(err, stats) { if(err) throw err; - expect(stats.uid).to.equal(500); - expect(stats.gid).to.equal(500); - //done(); - }); - }); - - fs.lchown('/file', 500, 500, function(err) { - if(err) throw err; - - fs.lstat('/file', function(err, stats) { - if(err) throw err; - expect(stats.uid).to.equal(500); expect(stats.gid).to.equal(500); done(); @@ -157,6 +145,34 @@ describe('fs.chown, fs.fchown, fs.lchown', function() { }); }); }); + + it('should allow updating gid and uid for a symlink file', function(done) { + var fs = util.fs(); + + fs.open('/file', 'w', function(err, fd) { + if(err) throw err; + + fs.symlink('/file', '/link', function(err) { + if(err) throw err; + + fs.lchown('/link', 600, 600, function(err) { + if(err) throw err; + + fs.lstat('/link', function(err, stats) { + if(err) throw err; + + expect(stats.uid).to.equal(600); + expect(stats.gid).to.equal(600); + + fs.close(fd, function(err) { + if(err) throw err; + done(); + }); + }); + }); + }); + }); + }); });