* Replaced var with either const or let and added strict mode in fs.readdir.spec.js * Replaced let with const
This commit is contained in:
parent
4a39dcc2f0
commit
0380a8153c
|
@ -1,17 +1,19 @@
|
||||||
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('fs.readdir', function() {
|
describe('fs.readdir', function() {
|
||||||
beforeEach(util.setup);
|
beforeEach(util.setup);
|
||||||
afterEach(util.cleanup);
|
afterEach(util.cleanup);
|
||||||
|
|
||||||
it('should be a function', function() {
|
it('should be a function', function() {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
expect(fs.readdir).to.be.a('function');
|
expect(fs.readdir).to.be.a('function');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return an error if the path does not exist', function(done) {
|
it('should return an error if the path does not exist', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
fs.readdir('/tmp/mydir', function(error, files) {
|
fs.readdir('/tmp/mydir', function(error, files) {
|
||||||
expect(error).to.exist;
|
expect(error).to.exist;
|
||||||
|
@ -22,7 +24,7 @@ describe('fs.readdir', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a list of files from an existing directory', function(done) {
|
it('should return a list of files from an existing directory', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
fs.mkdir('/tmp', function(error) {
|
fs.mkdir('/tmp', function(error) {
|
||||||
if(error) throw error;
|
if(error) throw error;
|
||||||
|
@ -38,7 +40,7 @@ describe('fs.readdir', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should follow symbolic links', function(done) {
|
it('should follow symbolic links', function(done) {
|
||||||
var fs = util.fs();
|
const fs = util.fs();
|
||||||
|
|
||||||
fs.mkdir('/tmp', function(error) {
|
fs.mkdir('/tmp', function(error) {
|
||||||
if(error) throw error;
|
if(error) throw error;
|
||||||
|
@ -56,12 +58,12 @@ describe('fs.readdir', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('(promise) should be a function', function() {
|
it('(promise) should be a function', function() {
|
||||||
var fsPromises = util.fs().promises;
|
const fsPromises = util.fs().promises;
|
||||||
expect(fsPromises.readdir).to.be.a('function');
|
expect(fsPromises.readdir).to.be.a('function');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return an error if the path is a file', function() {
|
it('should return an error if the path is a file', function() {
|
||||||
var fsPromises = util.fs().promises;
|
const fsPromises = util.fs().promises;
|
||||||
|
|
||||||
return fsPromises.writeFile('/myfile', 'contents')
|
return fsPromises.writeFile('/myfile', 'contents')
|
||||||
.then(() => fsPromises.readdir('/myfile'))
|
.then(() => fsPromises.readdir('/myfile'))
|
||||||
|
@ -72,7 +74,7 @@ describe('fs.readdir', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('(promise) should return a list of files from an existing directory', function() {
|
it('(promise) should return a list of files from an existing directory', function() {
|
||||||
var fsPromises = util.fs().promises;
|
const fsPromises = util.fs().promises;
|
||||||
|
|
||||||
return fsPromises.mkdir('/tmp')
|
return fsPromises.mkdir('/tmp')
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
Loading…
Reference in New Issue