This commit is contained in:
sjmathew 2018-09-26 22:19:46 -04:00
parent fd3de6be2c
commit a174241828
1 changed files with 42 additions and 0 deletions

View File

@ -104,3 +104,45 @@ describe('node times (atime, mtime, ctime) with mount flags', function() {
}); });
}); });
}); });
function memoryFS(flags, callback) {
var name = util.uniqueName();
return new Filer.FileSystem({
name: name,
flags: flags || [],
provider: new Filer.FileSystem.providers.Memory(name)
}, callback);
}
describe('fsPromises.update',function() {
beforeEach(util.setup);
afterEach(util.cleanup);
var filename = '/dir/file';
var newfilename = filename + '1';
it('should not update ctime when calling fs.rename() with NOCTIME', function() {
memoryFS(['NOCTIME'], function(error, fs) {
var fsPromises = util.fs().promises;
fsPromises.createTree(fs, function() {
fsPromises.stat(fs, filename, function(stats1) {
return fsPromises.rename(filename, newfilename)
.then(() => {
fs.stat(fsPromises, newfilename, function(stats2){
expect(stats2.ctime).to.equal(stats1.ctime);
expect(stats2.mtime).to.equal(stats1.mtime);
expect(stats2.atime).to.equal(stats1.atime);
});
})
.catch((error)=>{
throw(error);
});
});
});
});
});
});