Fix #568: switch all stats.type checks in tests/ to use is*() methods (#581)

* Fix Issue#568

* Fix issue 568: two more file changes

* Fix issue 568: more changes in tests/spec/shell/ls.spec.js
This commit is contained in:
yuzhouChen 2018-11-28 13:54:20 -05:00 committed by David Humphrey
parent a25d71b524
commit 89626107cc
12 changed files with 22 additions and 22 deletions

View File

@ -27,7 +27,7 @@ describe('fs.lstat', function() {
fs.lstat('/', function(error, result) {
expect(error).not.to.exist;
expect(result).to.exist;
expect(result.type).to.equal('DIRECTORY');
expect(result.isDirectory()).to.be.true;
done();
});
});
@ -41,7 +41,7 @@ describe('fs.lstat', function() {
fs.lstat('/mylink', function(error, result) {
expect(error).not.to.exist;
expect(result).to.exist;
expect(result.type).to.equal('SYMLINK');
expect(result.isSymbolicLink()).to.be.true;
done();
});
});

View File

@ -40,7 +40,7 @@ describe('fs.mkdir', function () {
fs.stat('/tmp', function (error, stats) {
expect(error).not.to.exist;
expect(stats).to.exist;
expect(stats.type).to.equal('DIRECTORY');
expect(stats.isDirectory()).to.be.true;
done();
});
});
@ -83,7 +83,7 @@ describe('fs.promises.mkdir', function () {
.then(() => fs.promises.stat('/tmp'))
.then(stats => {
expect(stats).to.exist;
expect(stats.type).to.equal('DIRECTORY');
expect(stats.isDirectory()).to.be.true;
});
});

View File

@ -60,7 +60,7 @@ describe('fs.mknod', function(){
fs.stat('/dir', function(error, stats){
expect(error).not.to.exist;
expect(stats.type).to.equal('DIRECTORY');
expect(stats.isDirectory()).to.be.true;
done();
});
});
@ -74,7 +74,7 @@ describe('fs.mknod', function(){
fs.stat('/file', function(error, result){
expect(error).not.to.exist;
expect(result.type).to.equal('FILE');
expect(result.isFile()).to.be.true;
done();
});
});

View File

@ -100,7 +100,7 @@ describe('fs.open', function() {
fs.stat('/myfile', function(error, result) {
expect(error).not.to.exist;
expect(result).to.exist;
expect(result.type).to.equal('FILE');
expect(result.isFile()).to.be.true;
done();
});
});

View File

@ -17,7 +17,7 @@ describe('fs', function() {
fs.stat('/', function(error, result) {
expect(error).not.to.exist;
expect(result).to.exist;
expect(result.type).to.equal('DIRECTORY');
expect(result.isDirectory()).to.be.true;
done();
});
});

View File

@ -117,7 +117,7 @@ describe('fs.stat', function() {
expect(result.atime).to.be.a('number');
expect(result.mtime).to.be.a('number');
expect(result.ctime).to.be.a('number');
expect(result.type).to.equal('DIRECTORY');
expect(result.isDirectory()).to.be.true;
});
});
});

View File

@ -38,7 +38,7 @@ describe('fs.symlink', function() {
fs.stat('/myfile', function(err, stats) {
expect(error).not.to.exist;
expect(stats.type).to.equal('DIRECTORY');
expect(stats.isDirectory()).to.be.true;
done();
});
});

View File

@ -97,7 +97,7 @@ describe('fs.unlink', function() {
fs.stat('/mydir', function (error, stats) {
expect(error).not.to.exist;
expect(stats).to.exist;
expect(stats.type).to.equal('DIRECTORY');
expect(stats.isDirectory()).to.be.true;
done();
});
});

View File

@ -24,7 +24,7 @@ describe('fs.write', function() {
fs.stat('/myfile', function(error, result) {
expect(error).not.to.exist;
expect(result.type).to.equal('FILE');
expect(result.isFile()).to.be.true;
expect(result.size).to.equal(buffer.length);
done();
});

View File

@ -15,7 +15,7 @@ describe('node.js tests: https://github.com/joyent/node/blob/master/test/simple/
fs.stat(pathname, function(error, result) {
expect(error).not.to.exist;
expect(result).to.exist;
expect(result.type).to.equal('DIRECTORY');
expect(result.isDirectory()).to.be.true;
done();
});
});
@ -31,7 +31,7 @@ describe('node.js tests: https://github.com/joyent/node/blob/master/test/simple/
fs.stat(pathname, function(error, result) {
expect(error).not.to.exist;
expect(result).to.exist;
expect(result.type).to.equal('DIRECTORY');
expect(result.isDirectory()).to.be.true;
done();
});
});

View File

@ -43,7 +43,7 @@ describe('FileSystemShell.ls', function() {
expect(item0.nlinks).to.equal(1);
expect(item0.size).to.equal(1);
expect(item0.mtime).to.be.a('number');
expect(item0.type).to.equal('FILE');
expect(item0.isFile()).to.be.true;
expect(item0.contents).not.to.exist;
var item1 = list[1];
@ -51,7 +51,7 @@ describe('FileSystemShell.ls', function() {
expect(item1.nlinks).to.equal(1);
expect(item1.size).to.equal(2);
expect(item1.mtime).to.be.a('number');
expect(item1.type).to.equal('FILE');
expect(item1.isFile()).to.be.true;
expect(item0.contents).not.to.exist;
done();
@ -88,7 +88,7 @@ describe('FileSystemShell.ls', function() {
expect(item.nlinks).to.equal(1);
expect(item.size).to.be.a('number');
expect(item.mtime).to.be.a('number');
expect(item.type).to.equal('DIRECTORY');
expect(item.isDirectory()).to.be.true;
expect(item.contents).not.to.exist;
break;
case 'file':
@ -96,7 +96,7 @@ describe('FileSystemShell.ls', function() {
expect(item.nlinks).to.equal(1);
expect(item.size).to.equal(1);
expect(item.mtime).to.be.a('number');
expect(item.type).to.equal('FILE');
expect(item.isFile()).to.be.true;
expect(item.contents).not.to.exist;
break;
default:
@ -147,7 +147,7 @@ describe('FileSystemShell.ls', function() {
expect(item.nlinks).to.equal(1);
expect(item.size).to.be.a('number');
expect(item.mtime).to.be.a('number');
expect(item.type).to.equal('DIRECTORY');
expect(item.isDirectory()).to.be.true;
expect(item.contents).to.exist;
expect(item.contents.length).to.equal(1);
var contents0 = item.contents[0];
@ -155,7 +155,7 @@ describe('FileSystemShell.ls', function() {
expect(contents0.nlinks).to.equal(1);
expect(contents0.size).to.equal(1);
expect(contents0.mtime).to.be.a('number');
expect(contents0.type).to.equal('FILE');
expect(contents0.isFile()).to.be.true;
expect(contents0.contents).not.to.exist;
break;
case 'file':
@ -163,7 +163,7 @@ describe('FileSystemShell.ls', function() {
expect(item.nlinks).to.equal(1);
expect(item.size).to.equal(1);
expect(item.mtime).to.be.a('number');
expect(item.type).to.equal('FILE');
expect(item.isFile()).to.be.true;
expect(item.contents).not.to.exist;
break;
default:

View File

@ -26,7 +26,7 @@ describe('FileSystemShell.touch', function() {
fs.stat('/newfile', function(error, stats) {
expect(error).not.to.exist;
expect(stats.type).to.equal('FILE');
expect(stats.isFile()).to.be.true;
done();
});
});