Skip to content

Commit

Permalink
test: nodejs v6 has no atimeMs in fs.stat
Browse files Browse the repository at this point in the history
  • Loading branch information
3cp committed May 8, 2021
1 parent 9cd00e2 commit 7483a4d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions test/lib/fs.lstat.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('fs.lstat(path, callback)', function() {
}
assert.isTrue(stats.isSymbolicLink());
assert.isFalse(stats.isFile());
assert.equal(stats.mtimeMs, 2);
assert.equal(stats.mtime.getTime(), 2);
done();
});
});
Expand All @@ -54,7 +54,7 @@ describe('fs.lstat(path, callback)', function() {
}
assert.isTrue(stats.isSymbolicLink());
assert.isFalse(stats.isFile());
assert.equal(stats.mtimeMs, 2);
assert.equal(stats.mtime.getTime(), 2);
done();
});
});
Expand All @@ -75,7 +75,7 @@ describe('fs.lstat(path, callback)', function() {
fs.promises.lstat('link').then(function(stats) {
assert.isTrue(stats.isSymbolicLink());
assert.isFalse(stats.isFile());
assert.equal(stats.mtimeMs, 2);
assert.equal(stats.mtime.getTime(), 2);
done();
}, done);
});
Expand All @@ -99,7 +99,7 @@ describe('fs.lstat(path, callback)', function() {
}
assert.isTrue(stats.isFile());
assert.isFalse(stats.isSymbolicLink());
assert.equal(stats.mtimeMs, 1);
assert.equal(stats.mtime.getTime(), 1);
done();
});
});
Expand All @@ -120,7 +120,7 @@ describe('fs.lstat(path, callback)', function() {
fs.promises.lstat('file.txt').then(function(stats) {
assert.isTrue(stats.isFile());
assert.isFalse(stats.isSymbolicLink());
assert.equal(stats.mtimeMs, 1);
assert.equal(stats.mtime.getTime(), 1);
done();
}, done);
});
Expand Down Expand Up @@ -177,7 +177,7 @@ describe('fs.lstatSync(path)', function() {
const stats = fs.lstatSync('link');
assert.isTrue(stats.isSymbolicLink());
assert.isFalse(stats.isFile());
assert.equal(stats.mtimeMs, 2);
assert.equal(stats.mtime.getTime(), 2);
});

inVersion('>=10.5.0').it('stats a symbolic link with bigint', function() {
Expand All @@ -191,7 +191,7 @@ describe('fs.lstatSync(path)', function() {
const stats = fs.lstatSync('file.txt');
assert.isTrue(stats.isFile());
assert.isFalse(stats.isSymbolicLink());
assert.equal(stats.mtimeMs, 1);
assert.equal(stats.mtime.getTime(), 1);
});

inVersion('>=10.5.0').it('stats a regular file with bigint', function() {
Expand Down
18 changes: 9 additions & 9 deletions test/lib/fs.stat-fstat.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('fs.stat(path, callback)', function() {
}
assert.isTrue(stats.isFile());
assert.isFalse(stats.isDirectory());
assert.equal(stats.mtimeMs, 2);
assert.equal(stats.mtime.getTime(), 2);
done();
});
});
Expand All @@ -76,7 +76,7 @@ describe('fs.stat(path, callback)', function() {
}
assert.isTrue(stats.isFile());
assert.isFalse(stats.isDirectory());
assert.equal(stats.mtimeMs, 2);
assert.equal(stats.mtime.getTime(), 2);
done();
});
});
Expand All @@ -101,7 +101,7 @@ describe('fs.stat(path, callback)', function() {
assert.isTrue(stats.isFile());
assert.isFalse(stats.isDirectory());
done();
assert.equal(stats.mtimeMs, 2);
assert.equal(stats.mtime.getTime(), 2);
}, done);
});

Expand Down Expand Up @@ -166,9 +166,9 @@ describe('fs.stat(path, callback)', function() {
if (err) {
return done(err);
}
assert.equal(stats.ctimeMs, 1);
assert.equal(stats.mtimeMs, 2);
assert.equal(stats.atimeMs, 3);
assert.equal(stats.ctime.getTime(), 1);
assert.equal(stats.mtime.getTime(), 2);
assert.equal(stats.atime.getTime(), 3);
assert.equal(stats.uid, 42);
assert.equal(stats.gid, 43);
assert.equal(stats.nlink, 1);
Expand All @@ -195,9 +195,9 @@ describe('fs.stat(path, callback)', function() {

withPromise.it('promise provides file stats', function(done) {
fs.promises.stat('/path/to/file.txt').then(function(stats) {
assert.equal(stats.ctimeMs, 1);
assert.equal(stats.mtimeMs, 2);
assert.equal(stats.atimeMs, 3);
assert.equal(stats.ctime.getTime(), 1);
assert.equal(stats.mtime.getTime(), 2);
assert.equal(stats.atime.getTime(), 3);
assert.equal(stats.uid, 42);
assert.equal(stats.gid, 43);
assert.equal(stats.nlink, 1);
Expand Down

0 comments on commit 7483a4d

Please # to comment.