Merge branch 'master' of github.com:filerjs/filer
This commit is contained in:
commit
e770ad0833
|
@ -1,15 +1,16 @@
|
||||||
var util = require('../lib/test-utils.js');
|
'use strict';
|
||||||
var expect = require('chai').expect;
|
const util = require('../lib/test-utils.js');
|
||||||
|
const expect = require('chai').expect;
|
||||||
|
|
||||||
describe('node times (atime, mtime, ctimeMs)', function() {
|
describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
beforeEach(util.setup);
|
beforeEach(util.setup);
|
||||||
afterEach(util.cleanup);
|
afterEach(util.cleanup);
|
||||||
|
|
||||||
var dirname = '/dir';
|
const dirname = '/dir';
|
||||||
var filename = '/dir/file';
|
const filename = '/dir/file';
|
||||||
|
|
||||||
function createTree(callback) {
|
function createTree(callback) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
fs.mkdir(dirname, function(error) {
|
fs.mkdir(dirname, function(error) {
|
||||||
if(error) throw error;
|
if(error) throw error;
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function stat(path, callback) {
|
function stat(path, callback) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
fs.stat(path, function(error, stats) {
|
fs.stat(path, function(error, stats) {
|
||||||
if(error) throw error;
|
if(error) throw error;
|
||||||
|
|
||||||
|
@ -31,8 +32,8 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
it('should update ctime when calling fs.rename()', function(done) {
|
it('should update ctime when calling fs.rename()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
var newfilename = filename + '1';
|
const newfilename = filename + '1';
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat(filename, function(stats1) {
|
stat(filename, function(stats1) {
|
||||||
|
@ -52,7 +53,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update ctime, mtime, atime when calling fs.truncate()', function(done) {
|
it('should update ctime, mtime, atime when calling fs.truncate()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat(filename, function(stats1) {
|
stat(filename, function(stats1) {
|
||||||
|
@ -72,7 +73,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update ctime, mtime, atime when calling fs.ftruncate()', function(done) {
|
it('should update ctime, mtime, atime when calling fs.ftruncate()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat(filename, function(stats1) {
|
stat(filename, function(stats1) {
|
||||||
|
@ -97,7 +98,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make no change when calling fs.stat()', function(done) {
|
it('should make no change when calling fs.stat()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat(filename, function(stats1) {
|
stat(filename, function(stats1) {
|
||||||
|
@ -115,7 +116,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make no change when calling fs.fstat()', function(done) {
|
it('should make no change when calling fs.fstat()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat(filename, function(stats1) {
|
stat(filename, function(stats1) {
|
||||||
|
@ -138,7 +139,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make no change when calling fs.lstat()', function(done) {
|
it('should make no change when calling fs.lstat()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
fs.link(filename, '/link', function(error) {
|
fs.link(filename, '/link', function(error) {
|
||||||
|
@ -159,7 +160,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make no change when calling fs.exists()', function(done) {
|
it('should make no change when calling fs.exists()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat(filename, function(stats1) {
|
stat(filename, function(stats1) {
|
||||||
|
@ -181,7 +182,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update ctime, atime when calling fs.link()', function(done) {
|
it('should update ctime, atime when calling fs.link()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat(filename, function(stats1) {
|
stat(filename, function(stats1) {
|
||||||
|
@ -200,7 +201,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make no change when calling fs.symlink()', function(done) {
|
it('should make no change when calling fs.symlink()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat(filename, function(stats1) {
|
stat(filename, function(stats1) {
|
||||||
|
@ -219,7 +220,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make no change when calling fs.readlink()', function(done) {
|
it('should make no change when calling fs.readlink()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
fs.symlink(filename, '/link', function(error) {
|
fs.symlink(filename, '/link', function(error) {
|
||||||
|
@ -243,7 +244,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update ctime, atime, mtime of parent dir when calling fs.unlink()', function(done) {
|
it('should update ctime, atime, mtime of parent dir when calling fs.unlink()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat(dirname, function(stats1) {
|
stat(dirname, function(stats1) {
|
||||||
|
@ -262,7 +263,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update ctime, atime, mtime of parent dir when calling fs.rmdir()', function(done) {
|
it('should update ctime, atime, mtime of parent dir when calling fs.rmdir()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat('/', function(stats1) {
|
stat('/', function(stats1) {
|
||||||
|
@ -286,7 +287,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update ctime, atime, mtime of parent dir when calling fs.mkdir()', function(done) {
|
it('should update ctime, atime, mtime of parent dir when calling fs.mkdir()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat('/', function(stats1) {
|
stat('/', function(stats1) {
|
||||||
|
@ -306,7 +307,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make no change when calling fs.close()', function(done) {
|
it('should make no change when calling fs.close()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
fs.open(filename, 'w', function(error, fd) {
|
fs.open(filename, 'w', function(error, fd) {
|
||||||
|
@ -329,7 +330,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make no change when calling fs.open()', function(done) {
|
it('should make no change when calling fs.open()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat(filename, function(stats1) {
|
stat(filename, function(stats1) {
|
||||||
|
@ -353,8 +354,8 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
it('should update atime, ctime, mtime when calling fs.write()', function(done) {
|
it('should update atime, ctime, mtime when calling fs.write()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
var buffer = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
|
const buffer = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
fs.open('/myfile', 'w', function(error, fd) {
|
fs.open('/myfile', 'w', function(error, fd) {
|
||||||
|
@ -382,8 +383,8 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make no change when calling fs.read()', function(done) {
|
it('should make no change when calling fs.read()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
var buffer = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
|
const buffer = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
fs.open('/myfile', 'w', function(err, fd) {
|
fs.open('/myfile', 'w', function(err, fd) {
|
||||||
|
@ -400,7 +401,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
if(error) throw error;
|
if(error) throw error;
|
||||||
|
|
||||||
stat('/myfile', function(stats1) {
|
stat('/myfile', function(stats1) {
|
||||||
var buffer2 = Buffer.alloc(buffer.length);
|
const buffer2 = Buffer.alloc(buffer.length);
|
||||||
|
|
||||||
fs.read(fd, buffer2, 0, buffer2.length, 0, function(err, nbytes) {
|
fs.read(fd, buffer2, 0, buffer2.length, 0, function(err, nbytes) {
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
|
@ -426,7 +427,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make no change when calling fs.readFile()', function(done) {
|
it('should make no change when calling fs.readFile()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat(filename, function(stats1) {
|
stat(filename, function(stats1) {
|
||||||
|
@ -446,7 +447,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update atime, ctime, mtime when calling fs.writeFile()', function(done) {
|
it('should update atime, ctime, mtime when calling fs.writeFile()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat(filename, function(stats1) {
|
stat(filename, function(stats1) {
|
||||||
|
@ -465,7 +466,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update atime, ctime, mtime when calling fs.appendFile()', function(done) {
|
it('should update atime, ctime, mtime when calling fs.appendFile()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat(filename, function(stats1) {
|
stat(filename, function(stats1) {
|
||||||
|
@ -484,7 +485,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update ctime, atime when calling fs.setxattr()', function(done) {
|
it('should update ctime, atime when calling fs.setxattr()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
stat(filename, function(stats1) {
|
stat(filename, function(stats1) {
|
||||||
|
@ -503,7 +504,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update ctime, atime when calling fs.fsetxattr()', function(done) {
|
it('should update ctime, atime when calling fs.fsetxattr()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
fs.open(filename, 'w', function(error, fd) {
|
fs.open(filename, 'w', function(error, fd) {
|
||||||
|
@ -526,7 +527,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make no change when calling fs.getxattr()', function(done) {
|
it('should make no change when calling fs.getxattr()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
fs.setxattr(filename, 'extra', 'data', function(error) {
|
fs.setxattr(filename, 'extra', 'data', function(error) {
|
||||||
|
@ -550,7 +551,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make no change when calling fs.fgetxattr()', function(done) {
|
it('should make no change when calling fs.fgetxattr()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
fs.open(filename, 'w', function(error, fd) {
|
fs.open(filename, 'w', function(error, fd) {
|
||||||
|
@ -578,7 +579,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update ctime, atime when calling fs.removexattr()', function(done) {
|
it('should update ctime, atime when calling fs.removexattr()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
fs.setxattr(filename, 'extra', 'data', function(error) {
|
fs.setxattr(filename, 'extra', 'data', function(error) {
|
||||||
|
@ -601,7 +602,7 @@ describe('node times (atime, mtime, ctimeMs)', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update ctime, atime when calling fs.fremovexattr()', function(done) {
|
it('should update ctime, atime when calling fs.fremovexattr()', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
createTree(function() {
|
createTree(function() {
|
||||||
fs.open(filename, 'w', function(error, fd) {
|
fs.open(filename, 'w', function(error, fd) {
|
||||||
|
|
Loading…
Reference in New Issue